cleanup(router): add a test verifying than NavigationEnd is not emitted after NavigationCancel

This commit is contained in:
vsavkin 2016-10-19 14:32:03 -07:00 committed by Alex Rickabaugh
parent 5ae6915600
commit 0f21a5823b
1 changed files with 7 additions and 0 deletions

View File

@ -888,6 +888,9 @@ describe('Integration', () => {
it('works', fakeAsync(inject([Router, Location], (router: Router, location: Location) => { it('works', fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp); const fixture = createRoot(router, RootCmp);
const recordedEvents: any[] = [];
router.events.forEach(e => recordedEvents.push(e));
router.resetConfig( router.resetConfig(
[{path: 'team/:id', component: TeamCmp, canActivate: ['alwaysFalse']}]); [{path: 'team/:id', component: TeamCmp, canActivate: ['alwaysFalse']}]);
@ -895,6 +898,10 @@ describe('Integration', () => {
advance(fixture); advance(fixture);
expect(location.path()).toEqual('/'); expect(location.path()).toEqual('/');
expectEvents(recordedEvents, [
[NavigationStart, '/team/22'], [RoutesRecognized, '/team/22'],
[NavigationCancel, '/team/22']
]);
}))); })));
}); });