fix(router): browser back and forward buttons not working correctly.

Closes #8524

Closes #8532
This commit is contained in:
Dimitrios Loukadakis
2016-05-08 04:24:46 +03:00
committed by Misko Hevery
parent 27c25bd0e8
commit 595bcdd1ac
3 changed files with 67 additions and 24 deletions

View File

@ -62,6 +62,25 @@ export function main() {
expect(location.path()).toEqual('/team/33/simple');
})));
it('should navigate back and forward',
fakeAsync(inject([Router, TestComponentBuilder, Location], (router, tcb, location) => {
let fixture = tcb.createFakeAsync(RootCmp);
router.navigateByUrl('/team/33/simple');
advance(fixture);
router.navigateByUrl('/team/22/user/victor');
advance(fixture);
location.back();
advance(fixture);
expect(location.path()).toEqual('/team/33/simple');
location.forward();
advance(fixture);
expect(location.path()).toEqual('/team/22/user/victor');
})));
it('should navigate when locations changes',
fakeAsync(inject([Router, TestComponentBuilder, Location], (router, tcb, location) => {
let fixture = tcb.createFakeAsync(RootCmp);