Skip to content

The design language that makes your AI harness better at design.

JavaScript

Test: give the oklch neon fixture flag and pass columns (#592)

Abdul Wahab8347d77f54ff
diff --git a/tests/detect-antipatterns-browser.test.mjs b/tests/detect-antipatterns-browser.test.mjs
index 7900fa527..e77d93231 100644
--- a/tests/detect-antipatterns-browser.test.mjs
+++ b/tests/detect-antipatterns-browser.test.mjs
@@ -221,12 +221,17 @@ describe('detectUrl — browser-only fixtures', () => {
assert.equal(contrast.length, 3, `expected exactly the 3 flag-column cases, got ${contrast.length}:\n${snippets}`);
});
- it('ai-color-palette: oklch neon text on a dark ground is flagged', async () => {
+ it('ai-color-palette: oklch neon text flags the should-flag column only', async () => {
const f = await detectUrl(`${baseUrl}/fixtures/antipatterns/oklch-neon-text.html`, { visualContrast: false });
- assert.ok(
- f.some(r => r.antipattern === 'ai-color-palette' && /Cyan neon text on dark background/i.test(r.snippet || '')),
- `expected cyan neon-text finding from oklch color, got: ${JSON.stringify(f.map(r => r.snippet))}`,
+ const neon = f.filter(r =>
+ r.antipattern === 'ai-color-palette' && /neon text on dark background/i.test(r.snippet || '')
+ );
+ assert.equal(
+ neon.length,
+ 1,
+ `expected exactly 1 oklch neon-text finding, got ${neon.length}: ${JSON.stringify(f.map(r => r.snippet))}`,
);
+ assert.match(neon[0].snippet || '', /Cyan neon text on dark background/i);
});
it('shadowed form.id: a <form> with <input name="id"> does not crash the scan (issue #407)', async () => {
diff --git a/tests/fixtures/antipatterns/oklch-neon-text.html b/tests/fixtures/antipatterns/oklch-neon-text.html
index 648504044..4e757fc72 100644
--- a/tests/fixtures/antipatterns/oklch-neon-text.html
+++ b/tests/fixtures/antipatterns/oklch-neon-text.html
@@ -7,23 +7,71 @@
<style>
:root {
--neon: oklch(0.85 0.2 195);
+ --muted: oklch(0.85 0.04 195);
+ --paper: oklch(0.9 0 0);
+ --ground: #050505;
+ --light: #f5f5f5;
}
body {
margin: 0;
padding: 32px;
- background: #050505;
+ background: var(--ground);
font-family: system-ui, sans-serif;
}
+ .grid {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 24px;
+ max-width: 980px;
+ margin: 0 auto;
+ }
+
+ .column {
+ display: grid;
+ gap: 14px;
+ }
+
+ .column > h2 {
+ margin: 0 0 2px;
+ color: var(--paper);
+ font-size: 13px;
+ font-weight: 700;
+ letter-spacing: 0.08em;
+ line-height: 1.4;
+ text-transform: uppercase;
+ }
+
p {
margin: 0;
- color: var(--neon);
font-size: 18px;
}
+
+ .neon-cyan { color: var(--neon); }
+ .muted-cyan { color: var(--muted); }
+ .oklch-paper { color: var(--paper); }
+
+ .light-shell {
+ background: var(--light);
+ padding: 12px;
+ }
</style>
</head>
<body>
- <p>Cyan neon token</p>
+ <main class="grid">
+ <section class="column" data-col="flag">
+ <h2>Should flag</h2>
+ <p class="neon-cyan">Cyan neon token</p>
+ </section>
+ <section class="column" data-col="pass">
+ <h2>Should pass</h2>
+ <p class="oklch-paper">Achromatic oklch on dark should pass</p>
+ <p class="muted-cyan">Muted cyan oklch on dark should pass</p>
+ <div class="light-shell">
+ <p class="neon-cyan">Cyan oklch on light ground should pass</p>
+ </div>
+ </section>
+ </main>
</body>
</html>