@@ -10,6 +10,7 @@ import {
1010 SimpleChanges ,
1111 Type ,
1212 isStandalone ,
13+ provideZonelessChangeDetection ,
1314} from '@angular/core' ;
1415import { ComponentFixture , DeferBlockBehavior , DeferBlockState , TestBed , tick } from '@angular/core/testing' ;
1516import { NavigationExtras , Router } from '@angular/router' ;
@@ -78,6 +79,7 @@ export async function render<SutType, WrapperType = SutType>(
7879 initialRoute = '' ,
7980 deferBlockStates = undefined ,
8081 deferBlockBehavior = undefined ,
82+ zoneless = false ,
8183 configureTestBed = ( ) => {
8284 /* noop*/
8385 } ,
@@ -105,6 +107,7 @@ export async function render<SutType, WrapperType = SutType>(
105107 imports : addAutoImports ( sut , {
106108 imports : imports . concat ( defaultImports ) ,
107109 routes,
110+ zoneless,
108111 } ) ,
109112 providers : [ ...providers ] ,
110113 schemas : [ ...schemas ] ,
@@ -510,11 +513,16 @@ function addAutoDeclarations<SutType>(
510513
511514function addAutoImports < SutType > (
512515 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' > ,
514521) {
515522 const routing = ( ) => ( routes ? [ RouterTestingModule . withRoutes ( routes ) ] : [ ] ) ;
516523 const components = ( ) => ( typeof sut !== 'string' && isStandalone ( sut ) ? [ sut ] : [ ] ) ;
517- return [ ...imports , ...components ( ) , ...routing ( ) ] ;
524+ const provideZoneless = ( ) => ( zoneless ? [ provideZonelessChangeDetection ( ) ] : [ ] ) ;
525+ return [ ...imports , ...components ( ) , ...routing ( ) , ...provideZoneless ( ) ] ;
518526}
519527
520528async function renderDeferBlock < SutType > (
0 commit comments