fix(router): support outlets in non-absolute positions
This commit is contained in:
@ -72,6 +72,12 @@ describe('createUrlTree', () => {
|
||||
expect(serializer.serialize(t)).toEqual('/a/(b//right:d/11/e)');
|
||||
});
|
||||
|
||||
it('should throw when outlets is not the last command', () => {
|
||||
const p = serializer.parse('/a');
|
||||
expect(() => createRoot(p, ['a', {outlets: {right: ['c']}}, 'c']))
|
||||
.toThrowError('{outlets:{}} has to be the last command');
|
||||
});
|
||||
|
||||
it('should support updating using a string', () => {
|
||||
const p = serializer.parse('/a(right:b)');
|
||||
const t = createRoot(p, [{outlets: {right: 'c/11/d'}}]);
|
||||
@ -188,6 +194,12 @@ describe('createUrlTree', () => {
|
||||
expect(() => create(p.root.children[PRIMARY_OUTLET], 0, p, ['../../']))
|
||||
.toThrowError('Invalid number of \'../\'');
|
||||
});
|
||||
|
||||
it('should support updating secondary segments', () => {
|
||||
const p = serializer.parse('/a/b');
|
||||
const t = create(p.root.children[PRIMARY_OUTLET], 1, p, [{outlets: {right: ['c']}}]);
|
||||
expect(serializer.serialize(t)).toEqual('/a/b/(right:c)');
|
||||
});
|
||||
});
|
||||
|
||||
it('should set query params', () => {
|
||||
@ -209,7 +221,6 @@ describe('createUrlTree', () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function createRoot(tree: UrlTree, commands: any[], queryParams?: Params, fragment?: string) {
|
||||
const s = new ActivatedRouteSnapshot(
|
||||
[], <any>{}, <any>{}, '', <any>{}, PRIMARY_OUTLET, 'someComponent', null, tree.root, -1,
|
||||
|
Reference in New Issue
Block a user