fix(router): ensuring MatchedUrl pass query params
This commit is contained in:
parent
3ac2821a1b
commit
7d853dd9ad
|
@ -111,10 +111,10 @@ export class ParamRoutePath implements RoutePath {
|
||||||
for (var i = 0; i < this._segments.length; i += 1) {
|
for (var i = 0; i < this._segments.length; i += 1) {
|
||||||
var pathSegment = this._segments[i];
|
var pathSegment = this._segments[i];
|
||||||
|
|
||||||
currentUrlSegment = nextUrlSegment;
|
|
||||||
if (pathSegment instanceof ContinuationPathSegment) {
|
if (pathSegment instanceof ContinuationPathSegment) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
currentUrlSegment = nextUrlSegment;
|
||||||
|
|
||||||
if (isPresent(currentUrlSegment)) {
|
if (isPresent(currentUrlSegment)) {
|
||||||
// the star segment consumes all of the remaining URL, including matrix params
|
// the star segment consumes all of the remaining URL, including matrix params
|
||||||
|
|
|
@ -296,6 +296,22 @@ export function main() {
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should match query params on the root component even when the next URL segment is null',
|
||||||
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
registry.config(RootHostCmp,
|
||||||
|
new Route({path: '/first/...', component: SingleSlashChildCmp}));
|
||||||
|
|
||||||
|
registry.recognize('/first?comments=all', [])
|
||||||
|
.then((instruction) => {
|
||||||
|
expect(instruction.component.componentType).toBe(SingleSlashChildCmp);
|
||||||
|
expect(instruction.component.params).toEqual({'comments': 'all'});
|
||||||
|
|
||||||
|
expect(instruction.child.component.componentType).toBe(DummyCmpB);
|
||||||
|
expect(instruction.child.component.params).toEqual({});
|
||||||
|
async.done();
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
it('should generate URLs with matrix and query params', () => {
|
it('should generate URLs with matrix and query params', () => {
|
||||||
registry.config(
|
registry.config(
|
||||||
RootHostCmp,
|
RootHostCmp,
|
||||||
|
|
Loading…
Reference in New Issue