fix(router): change processing url tree children condition (#26243)

stop adding next path of pathless activated route to the url

PR Close #26224

PR Close #26243
This commit is contained in:
miginmrs
2018-10-04 08:31:41 +01:00
committed by Igor Minar
parent f52600e261
commit ccc77ca441
2 changed files with 14 additions and 5 deletions

View File

@ -233,6 +233,12 @@ describe('createUrlTree', () => {
const t = create(p.root.children[PRIMARY_OUTLET], 1, p, [{outlets: {right: ['c']}}]);
expect(serializer.serialize(t)).toEqual('/a/b/(right:c)');
});
it('should support pathless route', () => {
const p = serializer.parse('/a');
const t = create(p.root.children[PRIMARY_OUTLET], -1, p, ['b']);
expect(serializer.serialize(t)).toEqual('/b');
});
});
it('should set fragment', () => {
@ -260,8 +266,8 @@ function create(
expect(segment).toBeDefined();
}
const s = new (ActivatedRouteSnapshot as any)(
[], <any>{}, <any>{}, '', <any>{}, PRIMARY_OUTLET, 'someComponent', null, <any>segment,
startIndex, <any>null);
segment.segments, <any>{}, <any>{}, '', <any>{}, PRIMARY_OUTLET, 'someComponent', null,
<any>segment, startIndex, <any>null);
const a = new (ActivatedRoute as any)(
new BehaviorSubject(null !), new BehaviorSubject(null !), new BehaviorSubject(null !),
new BehaviorSubject(null !), new BehaviorSubject(null !), PRIMARY_OUTLET, 'someComponent', s);