本文整理汇总了TypeScript中@angular/cli/utilities/get-dependent-files.getImportClauses函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getImportClauses函数的具体用法?TypeScript getImportClauses怎么用?TypeScript getImportClauses使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getImportClauses函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: expect
.then((tsFileBaz: ts.SourceFile) => {
let contentsBaz = dependentFilesUtils.getImportClauses(tsFileBaz);
let barExpectedContent = path.normalize('../bar/bar.component');
let fooBarExpectedContent = path.normalize('../foo-baz/qux/quux/foobar/foobar.component');
expect(contentsBaz[0].specifierText).to.equal(barExpectedContent);
expect(contentsBaz[1].specifierText).to.equal(fooBarExpectedContent);
});
示例2: expect
.then((tsFile: ts.SourceFile) => {
let contentsBaz = dependentFilesUtils.getImportClauses(tsFile);
let barExpectedContent = path.normalize('../bar/bar.component');
let fooBarExpectedContent =
`.${path.sep}qux${path.sep}quux${path.sep}foobar${path.sep}foobar.component`;
expect(contentsBaz[0].specifierText).toBe(barExpectedContent);
expect(contentsBaz[1].specifierText).toBe(fooBarExpectedContent);
})
示例3:
.then((tsFile: ts.SourceFile) => {
let contents = dependentFilesUtils.getImportClauses(tsFile);
let expectedContents = [{
specifierText: '../bar.component',
pos: 13,
end: 32
}];
assert.deepEqual(contents, expectedContents);
});
示例4: expect
.then((tsFile: ts.SourceFile) => {
let contents = dependentFilesUtils.getImportClauses(tsFile);
let expectedContents = [
{
specifierText: '../bar/baz/baz.component',
pos: 13,
end: 40
},
{
specifierText: '../bar/bar.component',
pos: 85,
end: 108
}
];
expect(contents).toEqual(expectedContents);
})