本文整理汇总了TypeScript中template-lint.Linter.lint方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Linter.lint方法的具体用法?TypeScript Linter.lint怎么用?TypeScript Linter.lint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类template-lint.Linter
的用法示例。
在下文中一共展示了Linter.lint方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("will reject duplicate named slot", (done) => {
linter.lint("<slot name='foo'></slot><slot name='foo'></slot><slot></slot>")
.then((issues) => {
expect(issues.length).toBe(1);
expect(issues[0].message).toBe("duplicated slot name (foo)");
done();
});
});
示例2: it
it("should not complain for tags without rules", async (done) => {
try {
let issues = await linter.lint('<template><div></div></template>');
expect(issues.length).toBe(0);
} catch (err) {
fail(err);
}
done();
});
示例3: it
it("will reject element where repeat and if is used", (done) => {
linter.lint(DEFAULT_RULES_VIOLATION_SAMPLE)
.then((errors) => {
const errMsg = getLoneError(errors).message;
expect(errMsg).toContain(ConflictingAttributesRule.ERRMSG_PREFIX);
expect(errMsg).toContain("repeat.for");
expect(errMsg).toContain("if.bind");
done();
});
});
示例4: it
it("will fail bad interpolation syntax in text node", (done) => {
var linter: Linter = new Linter([
new BindingRule(new Reflection())
]);
linter.lint('<div>${..}</div>')
.then((issues) => {
expect(issues.length).toBe(1);
expect(issues[0].message).toContain('Parser Error')
done();
});
});
示例5: it
it("will accept slots with template controllers in slot content", (done) => {
linter.lint(`
<slot>
<div if.bind='addMe'>valid</div>
<div repeat.for="item of items">also valid</div>
</slot>`)
.then((errors) => {
expect(errors.length).toBe(0);
done();
});
});