release: WRNexusJS 0.3.0
This commit is contained in:
@@ -30,6 +30,7 @@ const {
|
||||
findTopLevelDeclaration,
|
||||
maskLeadingTrivia,
|
||||
validateBalancedCharacters,
|
||||
validateRootMembers,
|
||||
} = require("../src/diagnostics");
|
||||
Module._load = originalLoad;
|
||||
|
||||
@@ -92,3 +93,25 @@ component ThemeToggle {
|
||||
|
||||
assert.deepEqual(diagnostics, []);
|
||||
});
|
||||
|
||||
test("accepts all WRN 0.3 root members without false unknown-member errors", () => {
|
||||
const source = `page Dashboard {
|
||||
runtime = "universal"
|
||||
hydrate = "visible"
|
||||
computed { doubled = count * 2 }
|
||||
effect { console.log(doubled) }
|
||||
security { auth = "required" }
|
||||
load server { return {} }
|
||||
action save(input) { return input }
|
||||
client { functions { function ready() {} } }
|
||||
view { <main>{doubled}</main> }
|
||||
}`;
|
||||
const declaration = findTopLevelDeclaration({}, source);
|
||||
const document = {
|
||||
positionAt(offset) {
|
||||
return offset;
|
||||
},
|
||||
};
|
||||
|
||||
assert.deepEqual(validateRootMembers(document, source, declaration.kind, declaration.match), []);
|
||||
});
|
||||
|
||||
@@ -19,3 +19,21 @@ test("preserves nested prop defaults while formatting", () => {
|
||||
assert.match(formatted, /options = \{ gap: 4, dense: false \}/);
|
||||
assert.equal(formatWrn(formatted, { insertSpaces: true, tabSize: 2 }), formatted);
|
||||
});
|
||||
|
||||
test("keeps long inline-closing tags idempotent after multiline expansion", () => {
|
||||
const source = `component Status {
|
||||
view {
|
||||
<section class="overflow-hidden rounded-3xl border border-[var(--wire-color-border,#e2e8f0)] bg-[var(--wire-color-surface,#ffffff)]">
|
||||
<span class="inline-flex items-center gap-2 rounded-full bg-[var(--wire-color-surface-2,#f8fafc)] px-3 py-1.5 text-xs font-semibold">
|
||||
<span class="h-2 w-2 animate-pulse rounded-full bg-[var(--wire-color-primary,#059669)]"></span>Loading
|
||||
</span>
|
||||
</section>
|
||||
}
|
||||
}
|
||||
`;
|
||||
const options = { insertSpaces: true, tabSize: 2, printWidth: 100 };
|
||||
const formatted = formatWrn(source, options);
|
||||
|
||||
assert.equal(formatWrn(formatted, options), formatted);
|
||||
assert.match(formatted, /<\/span>Loading/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user