release: WRNexusJS 0.3.5
This commit is contained in:
@@ -30,6 +30,7 @@ const {
|
||||
findTopLevelDeclaration,
|
||||
maskLeadingTrivia,
|
||||
validateBalancedCharacters,
|
||||
validateHtmlTags,
|
||||
validateRootMembers,
|
||||
} = require("../src/diagnostics");
|
||||
Module._load = originalLoad;
|
||||
@@ -115,3 +116,37 @@ test("accepts all WRN 0.3 root members without false unknown-member errors", ()
|
||||
|
||||
assert.deepEqual(validateRootMembers(document, source, declaration.kind, declaration.match), []);
|
||||
});
|
||||
|
||||
test("ignores member-like words inside component line and block comments", () => {
|
||||
const source = `component Counter {
|
||||
// Props are passed as attributes on the mount element.
|
||||
/* State and View are explained here, not declared here. */
|
||||
props {
|
||||
start = 0
|
||||
label = "Count"
|
||||
}
|
||||
state count = start
|
||||
view { <button>{label}: {count}</button> }
|
||||
}`;
|
||||
const declaration = findTopLevelDeclaration({}, source);
|
||||
|
||||
assert.deepEqual(
|
||||
validateRootMembers(mockDocument(source), source, declaration.kind, declaration.match),
|
||||
[],
|
||||
);
|
||||
});
|
||||
|
||||
test("ignores HTML-like tags inside WRN comments", () => {
|
||||
const source = `// The <section> below listens for child events.
|
||||
// <ComboBox> is only documentation in this comment.
|
||||
page Test {
|
||||
/*
|
||||
Example markup: <article><strong>Preview</strong></article>
|
||||
*/
|
||||
view {
|
||||
<main><section>Real content</section></main>
|
||||
}
|
||||
}`;
|
||||
|
||||
assert.deepEqual(validateHtmlTags(mockDocument(source), source), []);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user