test: cover housekeeping palette utilities
This commit is contained in:
1 parent
8bf4663336
commit
cc241f0b7e
1 file changed
+15
-1
@@ -86,7 +86,7 @@ const structuralBoundaryRules = [
|
|||||||
{
|
{
|
||||||
label: "palette color",
|
label: "palette color",
|
||||||
pattern:
|
pattern:
|
||||||
/(?:bg|text|border|from|to)-(?:white|black|slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)(?:-\d{2,3})?/,
|
/(?:bg|text|border|from|via|to|ring|outline|fill|stroke|divide|shadow|accent|caret|decoration|placeholder)-(?:white|black|slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)(?:-\d{2,3})?/,
|
||||||
},
|
},
|
||||||
{ label: "hex color", pattern: new RegExp("#" + "[0-9a-fA-F]{3,8}") },
|
{ label: "hex color", pattern: new RegExp("#" + "[0-9a-fA-F]{3,8}") },
|
||||||
{
|
{
|
||||||
@@ -302,4 +302,18 @@ describe("HousekeepingShell", () => {
|
|||||||
),
|
),
|
||||||
).toContain("palette color");
|
).toContain("palette color");
|
||||||
});
|
});
|
||||||
|
it("detects hard-coded Tailwind color utilities beyond foreground and backgrounds", () => {
|
||||||
|
for (const source of [
|
||||||
|
'className="ring-' + 'red-500"',
|
||||||
|
'className="outline-' + 'blue-500"',
|
||||||
|
'className="fill-' + 'green-500"',
|
||||||
|
'className="stroke-' + 'purple-500"',
|
||||||
|
'className="divide-' + 'amber-400"',
|
||||||
|
'className="via-' + 'cyan-500"',
|
||||||
|
]) {
|
||||||
|
expect(boundaryViolations(source, structuralBoundaryRules)).toContain(
|
||||||
|
"palette color",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user