release: WRNexusJS 0.2.77
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
const assert = require("node:assert");
|
||||
const { test } = require("node:test");
|
||||
const { formatWrn } = require("../src/formatter");
|
||||
|
||||
test("formats compact props blocks with one prop per line", () => {
|
||||
const source = `component Header {\nprops { eyebrow = "" title = "" description = "" align = "start" class = "" }\nview { <header>{title}</header> }\n}\n`;
|
||||
const expected = `component Header {\n props {\n eyebrow = ""\n title = ""\n description = ""\n align = "start"\n class = ""\n }\n view { <header>{title}</header> }\n}\n`;
|
||||
|
||||
assert.equal(formatWrn(source, { insertSpaces: true, tabSize: 2 }), expected);
|
||||
});
|
||||
|
||||
test("preserves nested prop defaults while formatting", () => {
|
||||
const source = `component Grid {\nprops { items = [{ label: "A" }, { label: "B" }] options = { gap: 4, dense: false } class = "" }\nview { <div/> }\n}\n`;
|
||||
const formatted = formatWrn(source, { insertSpaces: true, tabSize: 2 });
|
||||
|
||||
assert.match(formatted, /items = \[\{ label: "A" \}, \{ label: "B" \}\]/);
|
||||
assert.match(formatted, /options = \{ gap: 4, dense: false \}/);
|
||||
assert.equal(formatWrn(formatted, { insertSpaces: true, tabSize: 2 }), formatted);
|
||||
});
|
||||
Reference in New Issue
Block a user