本文整理匯總了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();
});
});