From 0f21a5823b3ef54919ca24f547724948f0056d68 Mon Sep 17 00:00:00 2001 From: vsavkin Date: Wed, 19 Oct 2016 14:32:03 -0700 Subject: [PATCH] cleanup(router): add a test verifying than NavigationEnd is not emitted after NavigationCancel --- modules/@angular/router/test/integration.spec.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/@angular/router/test/integration.spec.ts b/modules/@angular/router/test/integration.spec.ts index 33cfbde3d8..7518e61ea4 100644 --- a/modules/@angular/router/test/integration.spec.ts +++ b/modules/@angular/router/test/integration.spec.ts @@ -888,6 +888,9 @@ describe('Integration', () => { it('works', fakeAsync(inject([Router, Location], (router: Router, location: Location) => { const fixture = createRoot(router, RootCmp); + const recordedEvents: any[] = []; + router.events.forEach(e => recordedEvents.push(e)); + router.resetConfig( [{path: 'team/:id', component: TeamCmp, canActivate: ['alwaysFalse']}]); @@ -895,6 +898,10 @@ describe('Integration', () => { advance(fixture); expect(location.path()).toEqual('/'); + expectEvents(recordedEvents, [ + [NavigationStart, '/team/22'], [RoutesRecognized, '/team/22'], + [NavigationCancel, '/team/22'] + ]); }))); });