本文整理匯總了TypeScript中angular2/src/alt_router/router_url_parser.DefaultRouterUrlParser類的典型用法代碼示例。如果您正苦於以下問題:TypeScript DefaultRouterUrlParser類的具體用法?TypeScript DefaultRouterUrlParser怎麽用?TypeScript DefaultRouterUrlParser使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DefaultRouterUrlParser類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: describe
describe('url parsing', () => {
let parser = new DefaultRouterUrlParser();
it('should throw on an empty urls', () => { expect(() => parser.parse("")).toThrow(); });
it('should parse the root url', () => {
let tree = parser.parse("/");
expect(tree.root).toEqual(new UrlSegment("/", {}, ""));
});
it('should parse non-empty urls', () => {
let tree = parser.parse("one/two/three");
expect(tree.root).toEqual(new UrlSegment("one", {}, ""));
expect(tree.firstChild(tree.root)).toEqual(new UrlSegment("two", {}, ""));
expect(tree.firstChild(tree.firstChild(tree.root))).toEqual(new UrlSegment("three", {}, ""));
});
it('should parse non-empty absolute urls', () => {
let tree = parser.parse("/one/two");
expect(tree.root).toEqual(new UrlSegment("/one", {}, ""));
expect(tree.firstChild(tree.root)).toEqual(new UrlSegment("two", {}, ""));
});
});
示例2: it
it('should parse non-empty absolute urls', () => {
let tree = parser.parse("/one/two");
expect(tree.root).toEqual(new UrlSegment("/one", {}, ""));
expect(tree.firstChild(tree.root)).toEqual(new UrlSegment("two", {}, ""));
});