fix(router/instruction): ensure toLinkUrl includes extra params
Closes #7367
This commit is contained in:
parent
b5c769e1e4
commit
0d58b137a7
@ -160,7 +160,7 @@ export abstract class Instruction {
|
|||||||
// default instructions override these
|
// default instructions override these
|
||||||
toLinkUrl(): string {
|
toLinkUrl(): string {
|
||||||
return this.urlPath + this._stringifyAux() +
|
return this.urlPath + this._stringifyAux() +
|
||||||
(isPresent(this.child) ? this.child._toLinkUrl() : '');
|
(isPresent(this.child) ? this.child._toLinkUrl() : '') + this.toUrlQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is the non-root version (called recursively)
|
// this is the non-root version (called recursively)
|
||||||
|
@ -91,6 +91,15 @@ export function main() {
|
|||||||
expect(instruction.component.params).toEqual({});
|
expect(instruction.component.params).toEqual({});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should generate URLs with extra params in the query', () => {
|
||||||
|
registry.config(RootHostCmp,
|
||||||
|
new Route({path: '/first/second', component: DummyCmpA, name: 'FirstCmp'}));
|
||||||
|
|
||||||
|
var instruction = registry.generate(['FirstCmp', {a: 'one'}], []);
|
||||||
|
expect(instruction.toLinkUrl()).toEqual('first/second?a=one');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should generate URLs of loaded components after they are loaded',
|
it('should generate URLs of loaded components after they are loaded',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
registry.config(
|
registry.config(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user