test(router): test update location when route does not change

This commit is contained in:
vsavkin 2016-06-14 16:22:36 -07:00
parent b6ec22de6b
commit f5efccfb44
1 changed files with 20 additions and 0 deletions

View File

@ -128,6 +128,26 @@ describe("Integration", () => {
expect(fixture.debugElement.nativeElement).toHaveText('team 22 { user fedor, right: }');
})));
it('should update the location when the matched route does not change',
fakeAsync(inject([Router, TestComponentBuilder, Location], (router, tcb, location) => {
const fixture = tcb.createFakeAsync(RootCmp);
advance(fixture);
router.resetConfig([
{ path: '**', component: SimpleCmp }
]);
router.navigateByUrl('/one/two');
advance(fixture);
expect(location.path()).toEqual('/one/two');
expect(fixture.debugElement.nativeElement).toHaveText('simple');
router.navigateByUrl('/three/four');
advance(fixture);
expect(location.path()).toEqual('/three/four');
expect(fixture.debugElement.nativeElement).toHaveText('simple');
})));
it('should support secondary routes',
fakeAsync(inject([Router, TestComponentBuilder], (router, tcb) => {
const fixture = tcb.createFakeAsync(RootCmp);