fix(Router): fix checking for object intersection

This commit is contained in:
Victor Berchet 2017-01-05 15:56:24 -08:00 committed by Matias Niemelä
parent 99aa49ab6c
commit 6d29faefea
2 changed files with 3 additions and 3 deletions

View File

@ -40,7 +40,7 @@ function equalSegmentGroups(container: UrlSegmentGroup, containee: UrlSegmentGro
function containsQueryParams(
container: {[k: string]: string}, containee: {[k: string]: string}): boolean {
return Object.keys(containee) <= Object.keys(container) &&
return Object.keys(containee).length <= Object.keys(container).length &&
Object.keys(containee).every(key => containee[key] === container[key]);
}

View File

@ -102,8 +102,8 @@ describe('UrlTree', () => {
});
it('should return true when container contains containees queryParams', () => {
const t1 = serializer.parse('/one/two?test=1&page=5');
const t2 = serializer.parse('/one/two?test=1');
const t1 = serializer.parse('/one/two?test=1&u=5');
const t2 = serializer.parse('/one/two?u=5');
expect(containsTree(t1, t2, false)).toBe(true);
});