tests(router): add tests verifying that updating secondary segments using router link works

This commit is contained in:
vsavkin 2016-06-06 18:27:36 -07:00
parent ed50e17e5b
commit 56f8c95ee9
1 changed files with 13 additions and 0 deletions

View File

@ -26,6 +26,19 @@ describe('createUrlTree', () => {
expect(serializer.serialize(t)).toEqual("/a/11/d(right:c)"); expect(serializer.serialize(t)).toEqual("/a/11/d(right:c)");
}); });
it("should support updating secondary segments", () => {
const p = serializer.parse("/a(right:b)");
const t = create(p.root, p, ["right:c", 11, 'd']);
expect(t.children(t.root)[1].outlet).toEqual("right");
expect(serializer.serialize(t)).toEqual("/a(right:c/11/d)");
});
it("should support updating secondary segments (nested case)", () => {
const p = serializer.parse("/a/b(right:c)");
const t = create(p.root, p, ["a", "right:d", 11, 'e']);
expect(serializer.serialize(t)).toEqual("/a/b(right:d/11/e)");
});
it('should update matrix parameters', () => { it('should update matrix parameters', () => {
const p = serializer.parse("/a;aa=11"); const p = serializer.parse("/a;aa=11");
const t = create(p.root, p, ["/a", {aa: 22, bb: 33}]); const t = create(p.root, p, ["/a", {aa: 22, bb: 33}]);