fix(router): handle URL that does not match a route

Closes #7349
Closes #7203
This commit is contained in:
Peter Bacon Darwin
2016-03-02 15:04:08 +00:00
committed by Alex Eagle
parent aa43d2f87b
commit 8e3e45097a
2 changed files with 47 additions and 26 deletions

View File

@ -145,6 +145,22 @@ export function main() {
});
}));
it('should trigger the onError callback of a router change subscription if the URL does not match a route',
inject([AsyncTestCompleter], (async) => {
var outlet = makeDummyOutlet();
router.registerPrimaryOutlet(outlet)
.then((_) => router.config([new Route({path: '/a', component: DummyComponent})]))
.then((_) => {
router.subscribe((_) => {}, (url) => {
expect(url).toEqual('b');
async.done();
});
(<SpyLocation>location).simulateHashChange('b');
});
}));
it('should navigate after being configured', inject([AsyncTestCompleter], (async) => {
var outlet = makeDummyOutlet();