fix: normalize component boundary spacing

This commit is contained in:
2026-07-19 20:08:14 +05:30
parent eaea2c5f72
commit c5326f7622
191 changed files with 1280 additions and 351 deletions
+28
View File
@@ -87,6 +87,34 @@ test("page shells leave background ownership to the page", () => {
expect(shellRule).not.toMatch(/background(?:-color)?\s*:/);
});
test("component boundaries have no default margins and expose class customization", () => {
for (const name of uiComponentNames()) {
const source = readFileSync(join(uiComponentsDir(), `${name}.wrn`), "utf8");
const root = source.match(/view\s*\{\s*<[A-Za-z][^>]*>/)?.[0] ?? "";
const classes = root.match(/\bclass="([^"]*)"/)?.[1]?.split(/\s+/) ?? [];
expect(classes.filter((token) => /^-?m[trblxy]?-/.test(token))).toEqual([]);
expect(source).toMatch(/^\s*(?:class|className)\s*(?::[^=\r\n]+)?=/m);
expect(root).toMatch(/\{class(?:Name)?\}/);
}
});
test("layout boundaries do not add default padding", () => {
for (const name of [
"Container",
"CTASection",
"EmptyState",
"ErrorState",
"Hero",
"LegalDocumentLayout",
"TimelineItem",
]) {
const source = readFileSync(join(uiComponentsDir(), `${name}.wrn`), "utf8");
const root = source.match(/view\s*\{\s*<[A-Za-z][^>]*>/)?.[0] ?? "";
const classes = root.match(/\bclass="([^"]*)"/)?.[1]?.split(/\s+/) ?? [];
expect(classes.filter((token) => /^p[trblxy]?-/.test(token))).toEqual([]);
}
});
test("every bundled UI component compiles", () => {
for (const name of uiComponentNames()) {
const path = join(uiComponentsDir(), `${name}.wrn`);