fix(router): throw when generating non-terminal link
Closes #3979 Closes #4092
This commit is contained in:
@@ -79,9 +79,8 @@ export function main() {
|
||||
expect(url).toEqual('first/one/second/two');
|
||||
});
|
||||
|
||||
it('should geneate params as an empty StringMap when no params are given', () => {
|
||||
registry.config(RootHostCmp,
|
||||
new Route({path: '/test/...', component: DummyParentParamCmp, as: 'test'}));
|
||||
it('should generate params as an empty StringMap when no params are given', () => {
|
||||
registry.config(RootHostCmp, new Route({path: '/test', component: DummyCmpA, as: 'test'}));
|
||||
var instruction = registry.generate(['test'], RootHostCmp);
|
||||
expect(instruction.component.params).toEqual({});
|
||||
});
|
||||
@@ -232,6 +231,13 @@ export function main() {
|
||||
}
|
||||
});
|
||||
|
||||
it('should throw when linkParams are not terminal', () => {
|
||||
registry.config(RootHostCmp,
|
||||
new Route({path: '/first/...', component: DummyParentCmp, as: 'first'}));
|
||||
expect(() => { registry.generate(['first'], RootHostCmp); })
|
||||
.toThrowError('Link "["first"]" does not resolve to a terminal instruction.');
|
||||
});
|
||||
|
||||
it('should match matrix params on child components and query params on the root component',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
registry.config(RootHostCmp, new Route({path: '/first/...', component: DummyParentCmp}));
|
||||
|
||||
Reference in New Issue
Block a user