diff --git a/modules/@angular/router/test/integration.spec.ts b/modules/@angular/router/test/integration.spec.ts index a94dafb1c7c55..5eea06b763a9f 100644 --- a/modules/@angular/router/test/integration.spec.ts +++ b/modules/@angular/router/test/integration.spec.ts @@ -1118,6 +1118,34 @@ describe('Integration', () => { ]); }))); + it('works with aux routes', + fakeAsync(inject([Router, Location], (router: Router, location: Location) => { + const fixture = createRoot(router, RootCmp); + + router.resetConfig([{ + path: 'two-outlets', + component: TwoOutletsCmp, + children: [ + {path: 'a', component: BlankCmp}, { + path: 'b', + canDeactivate: ['RecordingDeactivate'], + component: SimpleCmp, + outlet: 'aux' + } + ] + }]); + + router.navigateByUrl('/two-outlets/(a//aux:b)'); + advance(fixture); + expect(location.path()).toEqual('/two-outlets/(a//aux:b)'); + + router.navigate(['two-outlets', {outlets: {aux: null}}]); + advance(fixture); + + expect(log).toEqual([['Deactivate', 'b']]); + expect(location.path()).toEqual('/two-outlets/(a)'); + }))); + it('works with a nested route', fakeAsync(inject([Router, Location], (router: Router, location: Location) => { const fixture = createRoot(router, RootCmp); @@ -1868,6 +1896,14 @@ class TeamCmp { } } +@Component({ + selector: 'two-outlets-cmp', + template: `[ , aux: ]` +}) +class TwoOutletsCmp { +} + + @Component({selector: 'user-cmp', template: `user {{name | async}}`}) class UserCmp { name: Observable; @@ -1970,6 +2006,7 @@ function createRoot(router: Router, type: any): ComponentFixture { entryComponents: [ BlankCmp, SimpleCmp, + TwoOutletsCmp, TeamCmp, UserCmp, StringLinkCmp, @@ -1994,6 +2031,7 @@ function createRoot(router: Router, type: any): ComponentFixture { exports: [ BlankCmp, SimpleCmp, + TwoOutletsCmp, TeamCmp, UserCmp, StringLinkCmp, @@ -2020,6 +2058,7 @@ function createRoot(router: Router, type: any): ComponentFixture { BlankCmp, SimpleCmp, TeamCmp, + TwoOutletsCmp, UserCmp, StringLinkCmp, DummyLinkCmp,