本文整理汇总了TypeScript中angular2/src/alt_router/router_url_serializer.DefaultRouterUrlSerializer类的典型用法代码示例。如果您正苦于以下问题:TypeScript DefaultRouterUrlSerializer类的具体用法?TypeScript DefaultRouterUrlSerializer怎么用?TypeScript DefaultRouterUrlSerializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DefaultRouterUrlSerializer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe('link', () => {
let parser = new DefaultRouterUrlSerializer();
it("should return the original tree when given an empty array", () => {
let p = parser.parse("/");
let t = link(s(p.root), p, []);
expect(t).toBe(p);
});
it("should support going to root", () => {
let p = parser.parse("/");
let t = link(s(p.root), p, ["/"]);
expect(parser.serialize(t)).toEqual("");
});
it("should support positional params", () => {
let p = parser.parse("/");
let t = link(s(p.root), p, ["/one", 11, "two", 22]);
expect(parser.serialize(t)).toEqual("/one/11/two/22");
});
it("should preserve route siblings when changing the main route", () => {
let p = parser.parse("/a/11/b(c)");
let t = link(s(p.root), p, ["/a", 11, 'd']);
expect(parser.serialize(t)).toEqual("/a/11/d(aux:c)");
});
it("should preserve route siblings when changing a aux route", () => {
let p = parser.parse("/a/11/b(c)");
let t = link(s(p.root), p, ["/a", 11, 'aux:d']);
expect(parser.serialize(t)).toEqual("/a/11/b(aux:d)");
});
it('should update parameters', () => {
let p = parser.parse("/a;aa=11");
let t = link(s(p.root), p, ["/a", {aa: 22, bb: 33}]);
expect(parser.serialize(t)).toEqual("/a;aa=22;bb=33");
});
});
开发者ID:844496869,项目名称:angular,代码行数:40,代码来源:link_spec.ts
示例2: it
it("should update relative subtree (when does not start with ./)", () => {
let p = parser.parse("/a(ap)/c(cp)");
let c = p.firstChild(p.root);
let tree = s(c);
let t = link(tree.root, tree, p, ["c2"]);
expect(parser.serialize(t)).toEqual("/a(aux:ap)/c2(aux:cp)");
});
开发者ID:davewragg,项目名称:angular,代码行数:7,代码来源:link_spec.ts
示例3: it
it("should parse key only matrix params", () => {
let tree = url.parse("/one;a");
let c = tree.firstChild(tree.root);
expectSegment(c, "one");
expectSegment(tree.firstChild(c), ";a=true");
expect(url.serialize(tree)).toEqual("/one;a=true");
});
开发者ID:844496869,项目名称:angular,代码行数:9,代码来源:router_url_serializer_spec.ts
示例4: it
it("should return the original tree when given an empty array", () => {
let p = parser.parse("/");
let t = link(s(p.root), p, []);
expect(t).toBe(p);
});
开发者ID:844496869,项目名称:angular,代码行数:5,代码来源:link_spec.ts
注:本文中的angular2/src/alt_router/router_url_serializer.DefaultRouterUrlSerializer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论