@@ -3366,6 +3366,72 @@ describe('Integration', () => {
33663366 expect ( location . path ( ) ) . toEqual ( '/lazy2/loaded' ) ;
33673367 } ) ) ) ;
33683368
3369+ it ( 'should allow lazy loaded module in named outlet' ,
3370+ fakeAsync ( inject (
3371+ [ Router , NgModuleFactoryLoader ] , ( router : Router , loader : SpyNgModuleFactoryLoader ) => {
3372+
3373+ @Component ( { selector : 'lazy' , template : 'lazy-loaded' } )
3374+ class LazyComponent {
3375+ }
3376+
3377+ @NgModule ( {
3378+ declarations : [ LazyComponent ] ,
3379+ imports : [ RouterModule . forChild ( [ { path : '' , component : LazyComponent } ] ) ]
3380+ } )
3381+ class LazyLoadedModule {
3382+ }
3383+
3384+ loader . stubbedModules = { lazyModule : LazyLoadedModule } ;
3385+
3386+ const fixture = createRoot ( router , RootCmp ) ;
3387+
3388+ router . resetConfig ( [ {
3389+ path : 'team/:id' ,
3390+ component : TeamCmp ,
3391+ children : [
3392+ { path : 'user/:name' , component : UserCmp } ,
3393+ { path : 'lazy' , loadChildren : 'lazyModule' , outlet : 'right' } ,
3394+ ]
3395+ } ] ) ;
3396+
3397+
3398+ router . navigateByUrl ( '/team/22/user/john' ) ;
3399+ advance ( fixture ) ;
3400+
3401+ expect ( fixture . nativeElement ) . toHaveText ( 'team 22 [ user john, right: ]' ) ;
3402+
3403+ router . navigateByUrl ( '/team/22/(user/john//right:lazy)' ) ;
3404+ advance ( fixture ) ;
3405+
3406+ expect ( fixture . nativeElement ) . toHaveText ( 'team 22 [ user john, right: lazy-loaded ]' ) ;
3407+ } ) ) ) ;
3408+
3409+ it ( 'should allow componentless named outlet to render children' ,
3410+ fakeAsync ( inject (
3411+ [ Router , NgModuleFactoryLoader ] , ( router : Router , loader : SpyNgModuleFactoryLoader ) => {
3412+
3413+ const fixture = createRoot ( router , RootCmp ) ;
3414+
3415+ router . resetConfig ( [ {
3416+ path : 'team/:id' ,
3417+ component : TeamCmp ,
3418+ children : [
3419+ { path : 'user/:name' , component : UserCmp } ,
3420+ { path : 'simple' , outlet : 'right' , children : [ { path : '' , component : SimpleCmp } ] } ,
3421+ ]
3422+ } ] ) ;
3423+
3424+
3425+ router . navigateByUrl ( '/team/22/user/john' ) ;
3426+ advance ( fixture ) ;
3427+
3428+ expect ( fixture . nativeElement ) . toHaveText ( 'team 22 [ user john, right: ]' ) ;
3429+
3430+ router . navigateByUrl ( '/team/22/(user/john//right:simple)' ) ;
3431+ advance ( fixture ) ;
3432+
3433+ expect ( fixture . nativeElement ) . toHaveText ( 'team 22 [ user john, right: simple ]' ) ;
3434+ } ) ) ) ;
33693435
33703436 describe ( 'should use the injector of the lazily-loaded configuration' , ( ) => {
33713437 class LazyLoadedServiceDefinedInModule { }
@@ -4102,6 +4168,10 @@ function createRoot(router: Router, type: any): ComponentFixture<any> {
41024168 return f ;
41034169}
41044170
4171+ @Component ( { selector : 'lazy' , template : 'lazy-loaded' } )
4172+ class LazyComponent {
4173+ }
4174+
41054175
41064176@NgModule ( {
41074177 imports : [ RouterTestingModule , CommonModule ] ,
0 commit comments