@@ -10,6 +10,7 @@ import {
10
10
SimpleChanges ,
11
11
Type ,
12
12
isStandalone ,
13
+ provideZonelessChangeDetection ,
13
14
} from '@angular/core' ;
14
15
import { ComponentFixture , DeferBlockBehavior , DeferBlockState , TestBed , tick } from '@angular/core/testing' ;
15
16
import { NavigationExtras , Router } from '@angular/router' ;
@@ -78,6 +79,7 @@ export async function render<SutType, WrapperType = SutType>(
78
79
initialRoute = '' ,
79
80
deferBlockStates = undefined ,
80
81
deferBlockBehavior = undefined ,
82
+ zoneless = false ,
81
83
configureTestBed = ( ) => {
82
84
/* noop*/
83
85
} ,
@@ -105,6 +107,7 @@ export async function render<SutType, WrapperType = SutType>(
105
107
imports : addAutoImports ( sut , {
106
108
imports : imports . concat ( defaultImports ) ,
107
109
routes,
110
+ zoneless,
108
111
} ) ,
109
112
providers : [ ...providers ] ,
110
113
schemas : [ ...schemas ] ,
@@ -510,11 +513,16 @@ function addAutoDeclarations<SutType>(
510
513
511
514
function addAutoImports < SutType > (
512
515
sut : Type < SutType > | string ,
513
- { imports = [ ] , routes } : Pick < RenderComponentOptions < any > , 'imports' | 'routes' > ,
516
+ {
517
+ imports = [ ] ,
518
+ routes,
519
+ zoneless,
520
+ } : Pick < RenderComponentOptions < any > , 'imports' | 'routes' > & Pick < Config , 'zoneless' > ,
514
521
) {
515
522
const routing = ( ) => ( routes ? [ RouterTestingModule . withRoutes ( routes ) ] : [ ] ) ;
516
523
const components = ( ) => ( typeof sut !== 'string' && isStandalone ( sut ) ? [ sut ] : [ ] ) ;
517
- return [ ...imports , ...components ( ) , ...routing ( ) ] ;
524
+ const provideZoneless = ( ) => ( zoneless ? [ provideZonelessChangeDetection ( ) ] : [ ] ) ;
525
+ return [ ...imports , ...components ( ) , ...routing ( ) , ...provideZoneless ( ) ] ;
518
526
}
519
527
520
528
async function renderDeferBlock < SutType > (
0 commit comments