fix: normalize component boundary spacing
This commit is contained in:
@@ -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`);
|
||||
|
||||
Reference in New Issue
Block a user