fix(router): do not require the creation of empty-path routes when no url left

Closes #12133
This commit is contained in:
vsavkin
2016-11-08 13:36:59 -08:00
committed by Victor Berchet
parent 2ced2a8a5a
commit 2c110931f8
5 changed files with 107 additions and 10 deletions

View File

@ -608,6 +608,34 @@ describe('recognize', () => {
});
});
describe('empty URL leftovers', () => {
it('should not throw when no children matching', () => {
checkRecognize(
[{path: 'a', component: ComponentA, children: [{path: 'b', component: ComponentB}]}],
'/a', (s: RouterStateSnapshot) => {
const a = s.firstChild(s.root);
checkActivatedRoute(a, 'a', {}, ComponentA);
});
});
it('should not throw when no children matching (aux routes)', () => {
checkRecognize(
[{
path: 'a',
component: ComponentA,
children: [
{path: 'b', component: ComponentB},
{path: '', component: ComponentC, outlet: 'aux'},
]
}],
'/a', (s: RouterStateSnapshot) => {
const a = s.firstChild(s.root);
checkActivatedRoute(a, 'a', {}, ComponentA);
checkActivatedRoute(a.children[0], '', {}, ComponentC, 'aux');
});
});
});
describe('query parameters', () => {
it('should support query params', () => {
const config = [{path: 'a', component: ComponentA}];