fix(Router): fix checking for object intersection
This commit is contained in:
parent
99aa49ab6c
commit
6d29faefea
|
@ -40,7 +40,7 @@ function equalSegmentGroups(container: UrlSegmentGroup, containee: UrlSegmentGro
|
||||||
|
|
||||||
function containsQueryParams(
|
function containsQueryParams(
|
||||||
container: {[k: string]: string}, containee: {[k: string]: string}): boolean {
|
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]);
|
Object.keys(containee).every(key => containee[key] === container[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,8 +102,8 @@ describe('UrlTree', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return true when container contains containees queryParams', () => {
|
it('should return true when container contains containees queryParams', () => {
|
||||||
const t1 = serializer.parse('/one/two?test=1&page=5');
|
const t1 = serializer.parse('/one/two?test=1&u=5');
|
||||||
const t2 = serializer.parse('/one/two?test=1');
|
const t2 = serializer.parse('/one/two?u=5');
|
||||||
expect(containsTree(t1, t2, false)).toBe(true);
|
expect(containsTree(t1, t2, false)).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue