fix(router/instruction): ensure toLinkUrl includes extra params

Closes #7367
This commit is contained in:
Peter Bacon Darwin 2016-03-04 14:24:48 +00:00 committed by Alex Eagle
parent b5c769e1e4
commit 0d58b137a7
2 changed files with 10 additions and 1 deletions

View File

@ -160,7 +160,7 @@ export abstract class Instruction {
// default instructions override these
toLinkUrl(): string {
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)

View File

@ -91,6 +91,15 @@ export function main() {
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',
inject([AsyncTestCompleter], (async) => {
registry.config(