本文整理汇总了TypeScript中polymer-analyzer.makeParseLoader函数的典型用法代码示例。如果您正苦于以下问题:TypeScript makeParseLoader函数的具体用法?TypeScript makeParseLoader怎么用?TypeScript makeParseLoader使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makeParseLoader函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: test
test('applies automatic-safe fixes', async() => {
const warnings = await linter.lint([`${ruleId}/before-fixes.html`]);
const edits = warnings.filter((w) => w.fix).map((w) => w.fix!);
const loader = makeParseLoader(analyzer, warnings.analysis);
const result = await applyEdits(edits, loader);
assert.deepEqual(
result.editedFiles.get(`${ruleId}/before-fixes.html`),
(await loader(`${ruleId}/after-fixes.html`)).contents);
});
开发者ID:asdfg9822,项目名称:polymer-linter,代码行数:9,代码来源:content-to-slot-declarations_test.ts
示例2: assertFileChanges
async function assertFileChanges(inputFile: string, outputFile: string) {
const warnings = await linter.lint([inputFile]);
const edits = warnings.filter((w) => w.fix).map((w) => w.fix!);
const loader = makeParseLoader(analyzer);
const result = await applyEdits(edits, loader);
const inputFileContent = result.editedFiles.get(inputFile)
const outputFileContent = (await loader(outputFile)).contents;
assert.deepEqual(inputFileContent, outputFileContent);
}
开发者ID:asdfg9822,项目名称:polymer-linter,代码行数:9,代码来源:paper-toolbar-v1-to-v2_test.ts
示例3: test
test('adds missing import by inferring the base path', async() => {
const warnings =
await linter.lint([`${ruleId}/forgot-import-before-fixes.html`]);
const edits = warnings.filter((w) => w.fix).map((w) => w.fix!);
const loader = makeParseLoader(analyzer, warnings.analysis);
const result = await applyEdits(edits, loader);
assert.deepEqual(
result.editedFiles.get(`${ruleId}/forgot-import-before-fixes.html`),
(await loader(`${ruleId}/forgot-import-after-fixes.html`)).contents);
});
开发者ID:asdfg9822,项目名称:polymer-linter,代码行数:10,代码来源:iron-flex-layout-import_test.ts
示例4: assertExpectedFixes
export async function assertExpectedFixes(
linter: Linter, analyzer: Analyzer, inputFile: string, goldenFile: string) {
const {warnings} = await linter.lint([inputFile]);
const edits = warnings.filter((w) => w.fix).map((w) => w.fix!);
const loader = makeParseLoader(analyzer);
const {editedFiles, incompatibleEdits} = await applyEdits(edits, loader);
assert.deepEqual(incompatibleEdits, []);
const inputFileContent = editedFiles.get(analyzer.resolveUrl(inputFile)!);
const outputFileContent =
(await loader(analyzer.resolveUrl(goldenFile)!)).contents;
assert.deepEqual(inputFileContent, outputFileContent);
}
开发者ID:MehdiRaash,项目名称:tools,代码行数:12,代码来源:util.ts
示例5: test
test('applies automatic-safe fixes', async() => {
const warnings = await linter.lint(
['deprecated-css-custom-property-syntax/before-fixes.html']);
const edits = warnings.filter((w) => w.fix).map((w) => w.fix!);
const loader = makeParseLoader(analyzer, warnings.analysis);
const result = await applyEdits(edits, loader);
assert.deepEqual(
result.editedFiles.get(
'deprecated-css-custom-property-syntax/before-fixes.html'),
(await loader('deprecated-css-custom-property-syntax/after-fixes.html'))
.contents);
assert.deepEqual(result.incompatibleEdits, []);
});
开发者ID:asdfg9822,项目名称:polymer-linter,代码行数:13,代码来源:deprecated-css-custom-property-syntax_test.ts
示例6: test
test('applies fixes and edit actions', async () => {
const {warnings, analysis} =
await linter.lint([`${ruleId}/before-fixes.html`]);
const edits = [];
for (const warning of warnings) {
if (warning.fix) {
edits.push(warning.fix);
}
for (const action of warning.actions || []) {
if (action.kind === 'edit') {
edits.push(action.edit);
}
}
}
const loader = makeParseLoader(analyzer, analysis);
const result = await applyEdits(edits, loader);
await assertFileEdited(
analyzer,
result,
`${ruleId}/before-fixes.html`,
`${ruleId}/after-edits.html`);
});
开发者ID:Polymer,项目名称:tools,代码行数:22,代码来源:content-to-slot-declarations_test.ts
注:本文中的polymer-analyzer.makeParseLoader函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论