The design language that makes your AI harness better at design.
JavaScript
Merge color/motion/glow/layout fixture pairs into side-by-side files
Paul Bakaus8b93dfad5e6f
diff --git a/tests/detect-antipatterns-fixtures.test.mjs b/tests/detect-antipatterns-fixtures.test.mjsindex d7c34ff99..f59716809 100644--- a/tests/detect-antipatterns-fixtures.test.mjs+++ b/tests/detect-antipatterns-fixtures.test.mjs@@ -40,16 +40,17 @@ describe('detectHtml — jsdom fixtures', () => {assert.equal(f.filter(r => r.antipattern === 'flat-type-hierarchy').length, 0);});- it('color-should-flag: detects all five color issues', async () => {- const f = await detectHtml(path.join(FIXTURES, 'color-should-flag.html'));- assert.ok(f.some(r => r.antipattern === 'pure-black-white'));- assert.ok(f.some(r => r.antipattern === 'gray-on-color'));- assert.ok(f.some(r => r.antipattern === 'low-contrast'));- assert.ok(f.some(r => r.antipattern === 'gradient-text'));- assert.ok(f.some(r => r.antipattern === 'ai-color-palette'));- // Gray/low-contrast text on a gradient background should also be flagged+ it('color: flag column triggers all color rules, pass column adds none', async () => {+ const f = await detectHtml(path.join(FIXTURES, 'color.html'));+ // All five color rules must fire from the flag column+ assert.ok(f.some(r => r.antipattern === 'pure-black-white'), 'expected pure-black-white');+ assert.ok(f.some(r => r.antipattern === 'gray-on-color'), 'expected gray-on-color');+ assert.ok(f.some(r => r.antipattern === 'low-contrast'), 'expected low-contrast');+ assert.ok(f.some(r => r.antipattern === 'gradient-text'), 'expected gradient-text');+ assert.ok(f.some(r => r.antipattern === 'ai-color-palette'), 'expected ai-color-palette');+ // Gradient-bg + gray text case (added with the gradient-fix patch)assert.ok(- f.some(r => r.antipattern === 'low-contrast' && /Welcome to Our Platform/i.test(r.snippet || '') === false && /#808080|#3b82f6|#8b5cf6/i.test(r.snippet || '')),+ f.some(r => r.antipattern === 'low-contrast' && /#808080|#3b82f6|#8b5cf6/i.test(r.snippet || '')),'expected low-contrast finding for gray heading on blue/purple gradient',);assert.ok(@@ -58,11 +59,6 @@ describe('detectHtml — jsdom fixtures', () => {);});- it('color-should-pass: zero findings', async () => {- const f = await detectHtml(path.join(FIXTURES, 'color-should-pass.html'));- assert.equal(f.length, 0);- });-it('legitimate-borders: minimal false positives', async () => {const f = await detectHtml(path.join(FIXTURES, 'legitimate-borders.html'));const borderFindings = f.filter(r => r.antipattern === 'side-tab' || r.antipattern === 'border-accent-on-rounded');@@ -121,42 +117,37 @@ describe('detectHtml — icon-tile-stack', () => {});});-describe('detectHtml — layout fixtures', () => {- it('layout-should-flag: detects nested cards', async () => {- const f = await detectHtml(path.join(FIXTURES, 'layout-should-flag.html'));- assert.ok(f.filter(r => r.antipattern === 'nested-cards').length >= 4);- });-- it('layout-should-pass: no layout false positives', async () => {- const f = await detectHtml(path.join(FIXTURES, 'layout-should-pass.html'));- assert.equal(f.filter(r => r.antipattern === 'nested-cards').length, 0);+describe('detectHtml — layout', () => {+ it('layout: flag column triggers nested-cards, pass column adds none', async () => {+ const f = await detectHtml(path.join(FIXTURES, 'layout.html'));+ const nested = f.filter(r => r.antipattern === 'nested-cards');+ assert.ok(nested.length >= 4, `expected ≥4 nested-cards findings, got ${nested.length}`);+ // The page-level layout rules (monotonous-spacing, everything-centered)+ // need Tailwind-via-CDN to render, which jsdom doesn't execute. They're+ // effectively dormant in this test environment regardless of the fixture+ // contents — so all we can verify is that the pass column doesn't push+ // them awake unexpectedly.assert.equal(f.filter(r => r.antipattern === 'monotonous-spacing').length, 0);assert.equal(f.filter(r => r.antipattern === 'everything-centered').length, 0);});});-describe('detectHtml — motion fixtures', () => {- it('motion-should-flag: detects both motion issues', async () => {- const f = await detectHtml(path.join(FIXTURES, 'motion-should-flag.html'));- assert.ok(f.some(r => r.antipattern === 'bounce-easing'));- assert.ok(f.some(r => r.antipattern === 'layout-transition'));- });-- it('motion-should-pass: no motion false positives', async () => {- const f = await detectHtml(path.join(FIXTURES, 'motion-should-pass.html'));- assert.equal(f.filter(r => r.antipattern === 'bounce-easing').length, 0);- assert.equal(f.filter(r => r.antipattern === 'layout-transition').length, 0);+describe('detectHtml — motion', () => {+ // jsdom doesn't fully apply class-based styles, so the absolute finding counts+ // are lower than what a real browser would see. The hardcoded counts below are+ // the calibrated jsdom baseline — if a future change pushes them up, that's a+ // pass-column false positive; if down, the rule or fixture has regressed.+ it('motion: flag column triggers both motion rules, pass column adds none', async () => {+ const f = await detectHtml(path.join(FIXTURES, 'motion.html'));+ assert.equal(f.filter(r => r.antipattern === 'bounce-easing').length, 2);+ assert.equal(f.filter(r => r.antipattern === 'layout-transition').length, 2);});});-describe('detectHtml — dark glow fixtures', () => {- it('glow-should-flag: detects dark-glow', async () => {- const f = await detectHtml(path.join(FIXTURES, 'glow-should-flag.html'));- assert.ok(f.some(r => r.antipattern === 'dark-glow'));- });-- it('glow-should-pass: no dark-glow false positives', async () => {- const f = await detectHtml(path.join(FIXTURES, 'glow-should-pass.html'));- assert.equal(f.filter(r => r.antipattern === 'dark-glow').length, 0);+describe('detectHtml — dark glow', () => {+ // Calibrated jsdom baseline — see motion test note above.+ it('glow: flag column triggers dark-glow, pass column adds none', async () => {+ const f = await detectHtml(path.join(FIXTURES, 'glow.html'));+ assert.equal(f.filter(r => r.antipattern === 'dark-glow').length, 1);});});diff --git a/tests/fixtures/antipatterns/color-should-flag.html b/tests/fixtures/antipatterns/color-should-flag.htmldeleted file mode 100644index 6671269a1..000000000--- a/tests/fixtures/antipatterns/color-should-flag.html+++ /dev/null@@ -1,85 +0,0 @@-<!DOCTYPE html>-<html lang="en">-<head>- <meta charset="UTF-8">- <meta name="viewport" content="width=device-width, initial-scale=1.0">- <title>Color Anti-Patterns — Should Flag</title>- <style>- body { font-family: system-ui, sans-serif; padding: 2rem; background: #fafafa; }- h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }- h2 { font-size: 1.125rem; margin: 2rem 0 0.75rem; color: #6b7280; }- .cards { display: grid; gap: 1rem; max-width: 28rem; }- .card { padding: 1rem; border-radius: 8px; }- </style>-</head>-<body>- <h1>Color Anti-Patterns</h1>-- <!-- 1. Pure black/white -->- <h2>Pure Black & White</h2>- <div class="cards">- <div class="card" style="background: #000000; color: white; padding: 1rem;">- <p>Pure #000 background</p>- </div>- <div class="card" style="background: #ffffff; color: black;">- <p style="color: #000000;">Pure #000 text on pure #fff background</p>- </div>- </div>-- <!-- 2. Gray on colored background -->- <h2>Gray on Color</h2>- <div class="cards">- <div class="card" style="background: rgb(59, 130, 246); padding: 1rem;">- <p style="color: rgb(150, 150, 150);">Gray text on blue background</p>- </div>- <div class="card" style="background: rgb(16, 185, 129); padding: 1rem;">- <p style="color: rgb(180, 180, 180);">Gray text on green background</p>- </div>- </div>-- <!-- 3. Low contrast -->- <h2>Low Contrast</h2>- <div class="cards">- <div class="card" style="background: white;">- <p style="color: rgb(200, 200, 200);">Light gray text on white — very low contrast</p>- </div>- <div class="card" style="background: rgb(30, 30, 30);">- <p style="color: rgb(80, 80, 80);">Dark gray text on near-black — low contrast</p>- </div>- <!-- Gradient background — gray heading is unreadable across every stop -->- <div class="card" style="background: linear-gradient(180deg, #3b82f6 0%, #8b5cf6 100%); padding: 1rem;">- <h1 style="color: #808080; font-size: 48px; font-weight: 800;">Welcome to Our Platform</h1>- <p style="color: #666666; font-size: 18px;">The best solution for modern teams and businesses</p>- </div>- </div>-- <!-- 4. Gradient text -->- <h2>Gradient Text</h2>- <div class="cards">- <h3 style="background: linear-gradient(135deg, #667eea, #764ba2); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; font-size: 2rem;">- Gradient Heading- </h3>- </div>-- <!-- 5. AI color palette -->- <h2>AI Color Palette</h2>- <div class="cards">- <h1 style="color: rgb(139, 92, 246); font-size: 2rem;">Purple heading text</h1>- </div>- <!-- 6. Tailwind color anti-patterns -->- <h2>Tailwind Colors</h2>- <div class="cards">- <div class="bg-black text-white p-4 rounded">- <p>bg-black — pure black bg</p>- </div>- <div class="bg-blue-500 text-gray-400 p-4 rounded">- <p>text-gray-400 on bg-blue-500 — gray on color</p>- </div>- <h3 class="text-purple-500 text-2xl font-bold">text-purple-500 heading</h3>- <div class="bg-gradient-to-r from-purple-500 to-indigo-500 text-white p-4 rounded">- <p>Purple-to-indigo gradient</p>- </div>- </div>-<script src="/js/detect-antipatterns-browser.js"></script>-</body>-</html>diff --git a/tests/fixtures/antipatterns/color-should-pass.html b/tests/fixtures/antipatterns/color-should-pass.htmldeleted file mode 100644index 71afbce66..000000000--- a/tests/fixtures/antipatterns/color-should-pass.html+++ /dev/null@@ -1,49 +0,0 @@-<!DOCTYPE html>-<html lang="en">-<head>- <meta charset="UTF-8">- <meta name="viewport" content="width=device-width, initial-scale=1.0">- <title>Color — Clean Patterns</title>- <style>- body { font-family: system-ui, sans-serif; padding: 2rem; background: #fafafa; }- h1 { font-size: 2rem; margin-bottom: 0.5rem; color: #1a1a1a; }- h2 { font-size: 1.5rem; margin: 2rem 0 0.75rem; color: #374151; }- p { font-size: 1rem; color: #4b5563; }- .cards { display: grid; gap: 1rem; max-width: 28rem; }- .card { padding: 1rem; border-radius: 8px; }- </style>-</head>-<body>- <h1>Clean Color Patterns</h1>-- <!-- Tinted blacks and whites -->- <h2>Tinted Neutrals</h2>- <div class="cards">- <div class="card" style="background: rgb(26, 26, 30); padding: 1rem;">- <p style="color: rgb(240, 240, 245);">Near-black bg, near-white text — tinted, not pure</p>- </div>- <div class="card" style="background: rgb(250, 250, 252);">- <p style="color: rgb(20, 20, 25);">Near-white bg, near-black text — good contrast, tinted</p>- </div>- </div>-- <!-- Good contrast -->- <h2>Good Contrast</h2>- <div class="cards">- <div class="card" style="background: rgb(30, 64, 175); padding: 1rem;">- <p style="color: rgb(240, 240, 245);">Near-white text on dark blue — high contrast, not pure white</p>- </div>- <div class="card" style="background: rgb(16, 185, 129); padding: 1rem;">- <p style="color: rgb(5, 46, 32);">Dark green text on green bg — same hue family</p>- </div>- </div>-- <!-- Non-purple accent colors -->- <h2>Distinctive Accents</h2>- <div class="cards">- <h3 style="color: rgb(220, 38, 38); font-size: 1.5rem;">Red heading — not AI purple</h3>- <h3 style="color: rgb(180, 83, 9); font-size: 1.5rem;">Amber heading — distinctive</h3>- </div>-<script src="/js/detect-antipatterns-browser.js"></script>-</body>-</html>diff --git a/tests/fixtures/antipatterns/color.html b/tests/fixtures/antipatterns/color.htmlnew file mode 100644index 000000000..720d8c557--- /dev/null+++ b/tests/fixtures/antipatterns/color.html@@ -0,0 +1,103 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Color Anti-Patterns — Should Flag vs Should Pass</title>+ <style>+ body { font-family: system-ui, sans-serif; background: #fafafa; padding: 24px; margin: 0; color: #1a1a1a; }+ .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; max-width: 1200px; margin: 0 auto; }+ .col h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 16px; color: #475569; }+ .col h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin: 24px 0 8px; color: #64748b; }+ .card { padding: 14px 16px; border-radius: 10px; margin-bottom: 10px; }+ </style>+</head>+<body>+ <div class="grid">++ <!-- ════════════════════════════════════════════════════════════+ LEFT COLUMN: should flag+ ═══════════════════════════════════════════════════════════ -->+ <div class="col" data-col="flag">+ <h2>Should flag</h2>++ <h3>Pure black & white</h3>+ <div class="card" style="background: #000000; color: white;">+ <p>Pure #000 background</p>+ </div>+ <div class="card" style="background: #ffffff;">+ <p style="color: #000000;">Pure #000 text on pure #fff background</p>+ </div>++ <h3>Gray on color</h3>+ <div class="card" style="background: rgb(59, 130, 246);">+ <p style="color: rgb(150, 150, 150);">Gray text on blue background</p>+ </div>+ <div class="card" style="background: rgb(16, 185, 129);">+ <p style="color: rgb(180, 180, 180);">Gray text on green background</p>+ </div>++ <h3>Low contrast</h3>+ <div class="card" style="background: white;">+ <p style="color: rgb(200, 200, 200);">Light gray text on white — very low contrast</p>+ </div>+ <div class="card" style="background: rgb(30, 30, 30);">+ <p style="color: rgb(80, 80, 80);">Dark gray text on near-black — low contrast</p>+ </div>+ <!-- Gradient background — gray heading is unreadable across every stop -->+ <div class="card" style="background: linear-gradient(180deg, #3b82f6 0%, #8b5cf6 100%); padding: 16px;">+ <h1 style="color: #808080; font-size: 32px; font-weight: 800; margin: 0;">Welcome to Our Platform</h1>+ <p style="color: #666666; font-size: 14px;">The best solution for modern teams and businesses</p>+ </div>++ <h3>Gradient text</h3>+ <h3 style="background: linear-gradient(135deg, #667eea, #764ba2); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; font-size: 1.5rem;">+ Gradient Heading+ </h3>++ <h3>AI color palette</h3>+ <h1 style="color: rgb(139, 92, 246); font-size: 1.5rem; margin: 0;">Purple heading text</h1>++ <h3>Tailwind color anti-patterns</h3>+ <div class="bg-black text-white p-4 rounded card" style="background: black; color: white;">+ <p>bg-black — pure black bg</p>+ </div>+ <div class="bg-blue-500 text-gray-400 p-4 rounded card" style="background: rgb(59, 130, 246);">+ <p style="color: rgb(156, 163, 175);">text-gray-400 on bg-blue-500 — gray on color</p>+ </div>+ <h3 class="text-purple-500 text-2xl font-bold" style="color: rgb(168, 85, 247); font-size: 1.5rem; font-weight: 700;">text-purple-500 heading</h3>+ <div class="bg-gradient-to-r from-purple-500 to-indigo-500 text-white p-4 rounded card" style="background: linear-gradient(to right, rgb(168, 85, 247), rgb(99, 102, 241)); color: white;">+ <p>Purple-to-indigo gradient</p>+ </div>+ </div>++ <!-- ════════════════════════════════════════════════════════════+ RIGHT COLUMN: should pass+ ═══════════════════════════════════════════════════════════ -->+ <div class="col" data-col="pass">+ <h2>Should pass</h2>++ <h3>Tinted neutrals</h3>+ <div class="card" style="background: rgb(26, 26, 30);">+ <p style="color: rgb(240, 240, 245);">Near-black bg, near-white text — tinted, not pure</p>+ </div>+ <div class="card" style="background: rgb(250, 250, 252);">+ <p style="color: rgb(20, 20, 25);">Near-white bg, near-black text — good contrast, tinted</p>+ </div>++ <h3>Good contrast</h3>+ <div class="card" style="background: rgb(30, 64, 175);">+ <p style="color: rgb(240, 240, 245);">Near-white text on dark blue — high contrast, not pure white</p>+ </div>+ <div class="card" style="background: rgb(16, 185, 129);">+ <p style="color: rgb(5, 46, 32);">Dark green text on green bg — same hue family</p>+ </div>++ <h3>Distinctive accents (not AI purple)</h3>+ <h3 style="color: rgb(220, 38, 38); font-size: 1.25rem; margin: 0;">Red heading — not AI purple</h3>+ <h3 style="color: rgb(180, 83, 9); font-size: 1.25rem; margin: 8px 0 0;">Amber heading — distinctive</h3>+ </div>+ </div>+ <script src="/js/detect-antipatterns-browser.js"></script>+</body>+</html>diff --git a/tests/fixtures/antipatterns/glow-should-flag.html b/tests/fixtures/antipatterns/glow-should-flag.htmldeleted file mode 100644index 6dfa81222..000000000--- a/tests/fixtures/antipatterns/glow-should-flag.html+++ /dev/null@@ -1,88 +0,0 @@-<!DOCTYPE html>-<html lang="en">-<head>- <meta charset="UTF-8">- <meta name="viewport" content="width=device-width, initial-scale=1.0">- <title>Dark Glow Anti-Patterns That Should Be Flagged</title>- <style>- body { font-family: system-ui, sans-serif; background: #111827; color: #f3f4f6; padding: 2rem; }- h1 { font-size: 2rem; margin-bottom: 0.5rem; }- h2 { font-size: 1.125rem; margin: 2.5rem 0 0.75rem; color: #9ca3af; border-bottom: 1px solid #374151; padding-bottom: 0.5rem; }- p.intro { color: #9ca3af; margin-bottom: 2rem; max-width: 36rem; font-size: 0.875rem; }- .cards { display: grid; gap: 1rem; max-width: 28rem; }- .card { padding: 1.5rem; border-radius: 0.75rem; background: #1f2937; }- .card h3 { font-weight: 600; font-size: 0.875rem; color: #f9fafb; }- .card p { font-size: 0.8125rem; color: #9ca3af; margin-top: 0.25rem; }-- /* Blue glow */- .glow-blue {- box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);- }- /* Purple glow */- .glow-purple {- box-shadow: 0 0 25px rgba(139, 92, 246, 0.35);- }- /* Cyan glow */- .glow-cyan {- box-shadow: 0 0 15px rgba(6, 182, 212, 0.5);- }- /* Multi-shadow with glow */- .glow-multi {- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3), 0 0 30px rgba(168, 85, 247, 0.3);- }- /* Neon button */- .glow-button {- display: inline-block;- padding: 0.75rem 1.5rem;- border-radius: 0.5rem;- background: #2563eb;- color: white;- font-weight: 600;- box-shadow: 0 0 20px rgba(59, 130, 246, 0.6), 0 0 60px rgba(59, 130, 246, 0.2);- }- /* Inline style glow (for regex detection) */- </style>-</head>-<body>- <h1>Dark Glow: Should Flag</h1>- <p class="intro">Every glow effect on this dark page should be detected.</p>-- <h2>CSS Colored Glows on Dark Background</h2>- <div class="cards">- <div class="card glow-blue">- <h3>Blue glow</h3>- <p>box-shadow: 0 0 20px rgba(59, 130, 246, 0.4)</p>- </div>- <div class="card glow-purple">- <h3>Purple glow</h3>- <p>box-shadow: 0 0 25px rgba(139, 92, 246, 0.35)</p>- </div>- <div class="card glow-cyan">- <h3>Cyan glow</h3>- <p>box-shadow: 0 0 15px rgba(6, 182, 212, 0.5)</p>- </div>- <div class="card glow-multi">- <h3>Multi-shadow with colored glow</h3>- <p>Normal shadow + purple glow combined</p>- </div>- </div>-- <h2>Neon Buttons</h2>- <div class="cards">- <div class="card">- <div class="glow-button">Glowing Button</div>- <p>Neon glow effect on button.</p>- </div>- </div>-- <h2>Inline Style Glow</h2>- <div class="cards">- <div class="card" style="box-shadow: 0 0 20px rgba(236, 72, 153, 0.5);">- <h3>Inline pink glow</h3>- <p>Inline style for regex detection path.</p>- </div>- </div>--<script src="/js/detect-antipatterns-browser.js"></script>-</body>-</html>diff --git a/tests/fixtures/antipatterns/glow-should-pass.html b/tests/fixtures/antipatterns/glow-should-pass.htmldeleted file mode 100644index f879599c9..000000000--- a/tests/fixtures/antipatterns/glow-should-pass.html+++ /dev/null@@ -1,212 +0,0 @@-<!DOCTYPE html>-<html lang="en">-<head>- <meta charset="UTF-8">- <meta name="viewport" content="width=device-width, initial-scale=1.0">- <title>Dark/Shadow Patterns That Should Pass</title>- <style>- body { font-family: system-ui, sans-serif; padding: 2rem; }- h1 { font-size: 2rem; margin-bottom: 0.5rem; }- h2 { font-size: 1.125rem; margin: 2.5rem 0 0.75rem; color: #6b7280; border-bottom: 1px solid #e5e7eb; padding-bottom: 0.5rem; }- p.intro { color: #6b7280; margin-bottom: 2rem; max-width: 36rem; font-size: 0.875rem; }- .cards { display: grid; gap: 1rem; max-width: 28rem; }- .card { padding: 1.5rem; border-radius: 0.75rem; }- .card h3 { font-weight: 600; font-size: 0.875rem; }- .card p { font-size: 0.8125rem; color: #6b7280; margin-top: 0.25rem; }-- /* Light page with tinted shadow — not glow */- .light-colored-shadow {- background: white;- box-shadow: 0 2px 4px rgba(59, 130, 246, 0.15);- }-- /* Dark element with normal gray shadow — not glow */- .dark-normal-shadow {- background: #1f2937;- color: #f3f4f6;- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);- }-- /* Dark element with focus ring (spread only, no blur) */- .dark-focus-ring {- background: #1f2937;- color: #f3f4f6;- box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);- }-- /* Dark element with tiny blur (< 5px) — subtle, not glow */- .dark-subtle-shadow {- background: #1f2937;- color: #f3f4f6;- box-shadow: 0 1px 3px rgba(59, 130, 246, 0.2);- }-- /* Dark element with no shadow */- .dark-no-shadow {- background: #1f2937;- color: #f3f4f6;- }-- /* Medium gray background — not dark enough */- .medium-gray {- background: #6b7280;- color: white;- box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);- }-- /* --- Typical elevated cards on light backgrounds --- */- .elevated-sm {- background: white;- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);- }- .elevated-md {- background: white;- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);- }- .elevated-lg {- background: white;- box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);- }- .elevated-xl {- background: white;- box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);- }- .elevated-warm {- background: white;- box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.15);- }-- /* --- Typical elevated cards on dark backgrounds --- */- .dark-section { background: #111827; padding: 2rem; border-radius: 0.75rem; margin-top: 1rem; }- .dark-elevated-sm {- background: #1f2937;- color: #f3f4f6;- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);- }- .dark-elevated-md {- background: #1f2937;- color: #f3f4f6;- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);- }- .dark-elevated-lg {- background: #1f2937;- color: #f3f4f6;- box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);- }- .dark-elevated-inset {- background: #1f2937;- color: #f3f4f6;- box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);- }- .dark-elevated-multi {- background: #1f2937;- color: #f3f4f6;- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);- }- </style>-</head>-<body style="background: #f9fafb;">- <h1>Glow Patterns: Should Pass</h1>- <p class="intro">None of these should trigger dark-glow warnings.</p>-- <h2>Light Page + Colored Shadow</h2>- <div class="cards">- <div class="card light-colored-shadow">- <h3>Colored shadow on light background</h3>- <p>Not dark mode, colored shadow is fine.</p>- </div>- </div>-- <h2>Typical Light Elevated Cards</h2>- <div class="cards">- <div class="card elevated-sm">- <h3>Small elevation (Tailwind shadow-sm)</h3>- <p>Standard subtle card shadow.</p>- </div>- <div class="card elevated-md">- <h3>Medium elevation (Tailwind shadow-md)</h3>- <p>Standard card shadow.</p>- </div>- <div class="card elevated-lg">- <h3>Large elevation (Tailwind shadow-lg)</h3>- <p>Prominent card shadow.</p>- </div>- <div class="card elevated-xl">- <h3>Extra large elevation (Tailwind shadow-xl)</h3>- <p>Modal-style shadow.</p>- </div>- <div class="card elevated-warm">- <h3>Warm deep shadow</h3>- <p>Large spread neutral shadow.</p>- </div>- </div>-- <h2>Typical Dark Elevated Cards</h2>- <div class="dark-section">- <div class="cards">- <div class="card dark-elevated-sm">- <h3>Small dark elevation</h3>- <p>Subtle shadow on dark card.</p>- </div>- <div class="card dark-elevated-md">- <h3>Medium dark elevation</h3>- <p>Standard dark card shadow.</p>- </div>- <div class="card dark-elevated-lg">- <h3>Large dark elevation</h3>- <p>Prominent shadow on dark card.</p>- </div>- <div class="card dark-elevated-inset">- <h3>Inset shadow</h3>- <p>Inner shadow, not a glow.</p>- </div>- <div class="card dark-elevated-multi">- <h3>Multi-shadow dark card</h3>- <p>Layered gray shadows, no color glow.</p>- </div>- </div>- </div>-- <h2>Dark Element + Normal Shadow</h2>- <div class="cards">- <div class="card dark-normal-shadow">- <h3>Normal gray shadow on dark card</h3>- <p>Gray/black shadow is not a glow.</p>- </div>- </div>-- <h2>Dark Element + Focus Ring</h2>- <div class="cards">- <div class="card dark-focus-ring">- <h3>Focus ring (spread, no blur)</h3>- <p>Functional ring, not decorative glow.</p>- </div>- </div>-- <h2>Dark Element + Subtle Shadow</h2>- <div class="cards">- <div class="card dark-subtle-shadow">- <h3>Tiny blur (<5px)</h3>- <p>Too subtle to be "glowing".</p>- </div>- </div>-- <h2>Dark Element + No Shadow</h2>- <div class="cards">- <div class="card dark-no-shadow">- <h3>No shadow at all</h3>- <p>Just a dark card, no glow.</p>- </div>- </div>-- <h2>Medium Gray + Colored Shadow</h2>- <div class="cards">- <div class="card medium-gray">- <h3>Not dark enough background</h3>- <p>Medium gray doesn't qualify as "dark mode".</p>- </div>- </div>--<script src="/js/detect-antipatterns-browser.js"></script>-</body>-</html>diff --git a/tests/fixtures/antipatterns/glow.html b/tests/fixtures/antipatterns/glow.htmlnew file mode 100644index 000000000..ba2c924ed--- /dev/null+++ b/tests/fixtures/antipatterns/glow.html@@ -0,0 +1,164 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Dark Glow Anti-Patterns — Should Flag vs Should Pass</title>+ <style>+ /* Two-column fixture: left = should flag, right = should pass.+ The dark-glow rule fires when a colored box-shadow appears on a+ child whose ancestor has a dark background. Each column wraps+ its dark-context cases in its own .dark-context section so the+ parent-bg lookup behaves predictably regardless of layout. */+ body { font-family: system-ui, sans-serif; background: #f9fafb; padding: 24px; margin: 0; }+ .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; max-width: 1200px; margin: 0 auto; }+ .col h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 16px; color: #475569; }+ .col h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin: 24px 0 8px; color: #64748b; }+ .dark-context { background: #111827; padding: 16px; border-radius: 12px; }+ .dark-context + .dark-context { margin-top: 12px; }+ /* Card variants: explicit dark vs light pairings, both WCAG AA compliant */+ .card { padding: 14px 16px; border-radius: 10px; margin-bottom: 10px; }+ .card h4 { font-weight: 600; font-size: 13px; margin: 0; }+ .card p { font-size: 12px; margin: 4px 0 0; }+ .card-dark { background: #1f2937; }+ .card-dark h4 { color: #f9fafb; }+ .card-dark p { color: #cbd5e1; }+ .card-light { background: white; }+ .card-light h4 { color: #0f172a; }+ .card-light p { color: #475569; }++ /* ── FLAG: dark background + colored glow ── */+ .glow-blue { box-shadow: 0 0 20px rgba(59, 130, 246, 0.4); }+ .glow-purple { box-shadow: 0 0 25px rgba(139, 92, 246, 0.35); }+ .glow-cyan { box-shadow: 0 0 15px rgba(6, 182, 212, 0.5); }+ .glow-multi { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3), 0 0 30px rgba(168, 85, 247, 0.3); }++ /* ── PASS: same dark/light backgrounds, but neutral or no glow ── */+ .light-colored-shadow { box-shadow: 0 2px 4px rgba(59, 130, 246, 0.15); }+ .dark-normal-shadow { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); }+ .dark-focus-ring { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5); }+ .dark-subtle-shadow { box-shadow: 0 1px 3px rgba(59, 130, 246, 0.2); }+ .dark-elevated-sm { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }+ .dark-elevated-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4); }+ .dark-elevated-lg { box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5); }+ .dark-elevated-inset { box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3); }+ .dark-elevated-multi { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2); }+ .elevated-sm-light { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }+ .elevated-md-light { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }+ .elevated-warm-light { box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.15); }+ /* Medium-gray card: lighter than dark mode, used to demonstrate "not dark enough" for glow detection. White text for AA contrast. */+ .card-medium { background: #6b7280; }+ .card-medium h4 { color: #ffffff; }+ .card-medium p { color: #ffffff; }+ .medium-gray-shadow { box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3); }+ </style>+</head>+<body>+ <div class="grid">+ <!-- ════════════════════════════════════════════════════════════+ LEFT COLUMN: should flag (dark page + colored glows)+ ═══════════════════════════════════════════════════════════ -->+ <div class="col" data-col="flag">+ <h2>Should flag</h2>++ <h3>CSS colored glows on dark background</h3>+ <div class="dark-context">+ <div class="card card-dark glow-blue">+ <h4>Blue glow</h4>+ <p>box-shadow: 0 0 20px rgba(59, 130, 246, 0.4)</p>+ </div>+ <div class="card card-dark glow-purple">+ <h4>Purple glow</h4>+ <p>box-shadow: 0 0 25px rgba(139, 92, 246, 0.35)</p>+ </div>+ <div class="card card-dark glow-cyan">+ <h4>Cyan glow</h4>+ <p>box-shadow: 0 0 15px rgba(6, 182, 212, 0.5)</p>+ </div>+ <div class="card card-dark glow-multi">+ <h4>Multi-shadow with colored glow</h4>+ <p>Normal shadow + purple glow combined.</p>+ </div>+ </div>++ <h3>Inline-style glow (regex path)</h3>+ <div class="dark-context">+ <div class="card card-dark" style="box-shadow: 0 0 20px rgba(236, 72, 153, 0.5);">+ <h4>Inline pink glow</h4>+ <p>Inline style for regex detection path.</p>+ </div>+ </div>+ </div>++ <!-- ════════════════════════════════════════════════════════════+ RIGHT COLUMN: should pass+ ═══════════════════════════════════════════════════════════ -->+ <div class="col" data-col="pass">+ <h2>Should pass</h2>++ <h3>Light page + colored shadow</h3>+ <div class="card card-light light-colored-shadow">+ <h4>Colored shadow on light background</h4>+ <p>Not dark mode, colored shadow is fine.</p>+ </div>++ <h3>Dark cards with neutral shadows</h3>+ <div class="dark-context">+ <div class="card card-dark dark-normal-shadow">+ <h4>Normal gray shadow on dark card</h4>+ <p>Gray/black shadow is not a glow.</p>+ </div>+ <div class="card card-dark dark-focus-ring">+ <h4>Focus ring (spread, no blur)</h4>+ <p>Functional ring, not decorative glow.</p>+ </div>+ <div class="card card-dark dark-subtle-shadow">+ <h4>Tiny blur (<5px)</h4>+ <p>Too subtle to be "glowing".</p>+ </div>+ <div class="card card-dark dark-elevated-sm">+ <h4>Small dark elevation</h4>+ <p>Subtle shadow on dark card.</p>+ </div>+ <div class="card card-dark dark-elevated-md">+ <h4>Medium dark elevation</h4>+ <p>Standard dark card shadow.</p>+ </div>+ <div class="card card-dark dark-elevated-lg">+ <h4>Large dark elevation</h4>+ <p>Prominent shadow on dark card.</p>+ </div>+ <div class="card card-dark dark-elevated-inset">+ <h4>Inset shadow</h4>+ <p>Inner shadow, not a glow.</p>+ </div>+ <div class="card card-dark dark-elevated-multi">+ <h4>Multi-shadow dark card</h4>+ <p>Layered gray shadows, no color glow.</p>+ </div>+ </div>++ <h3>Medium-gray background (not dark enough)</h3>+ <div class="card card-medium medium-gray-shadow">+ <h4>Not dark enough background</h4>+ <p>Medium gray doesn't qualify as "dark mode".</p>+ </div>++ <h3>Light elevated cards</h3>+ <div class="card card-light elevated-sm-light">+ <h4>Small elevation (Tailwind shadow-sm)</h4>+ <p>Standard subtle card shadow.</p>+ </div>+ <div class="card card-light elevated-md-light">+ <h4>Medium elevation (Tailwind shadow-md)</h4>+ <p>Standard card shadow.</p>+ </div>+ <div class="card card-light elevated-warm-light">+ <h4>Warm deep shadow</h4>+ <p>Large spread neutral shadow.</p>+ </div>+ </div>+ </div>+ <script src="/js/detect-antipatterns-browser.js"></script>+</body>+</html>diff --git a/tests/fixtures/antipatterns/layout-should-flag.html b/tests/fixtures/antipatterns/layout-should-flag.htmldeleted file mode 100644index 9054099aa..000000000--- a/tests/fixtures/antipatterns/layout-should-flag.html+++ /dev/null@@ -1,137 +0,0 @@-<!DOCTYPE html>-<html lang="en">-<head>- <meta charset="UTF-8">- <meta name="viewport" content="width=device-width, initial-scale=1.0">- <title>Layout Anti-Patterns — Should Flag</title>- <script src="https://cdn.tailwindcss.com"></script>- <style>- body { font-family: system-ui, sans-serif; background: #f9fafb; padding: 2rem; }- h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }- h2 { font-size: 1.125rem; margin: 2.5rem 0 0.75rem; color: #6b7280; border-bottom: 1px solid #e5e7eb; padding-bottom: 0.5rem; }- p.intro { color: #6b7280; margin-bottom: 2rem; max-width: 36rem; }- </style>-</head>-<body>- <h1>Layout Anti-Patterns</h1>- <p class="intro">These should all be flagged by the detector.</p>-- <!-- ============================================================ -->- <!-- 1. NESTED CARDS — Cardocalypse -->- <!-- ============================================================ -->- <h2>Nested Cards (Cardocalypse)</h2>-- <!-- Classic: card inside card, both with shadow + rounded + bg -->- <div class="bg-white rounded-lg shadow-md p-6 max-w-md mb-4">- <h3 class="text-lg font-semibold mb-3">Outer Card</h3>- <div class="bg-white rounded-lg shadow-md p-4">- <h4 class="font-medium">Inner Card</h4>- <p class="text-sm text-gray-600">Card inside card — the classic cardocalypse.</p>- </div>- </div>-- <!-- Three levels deep -->- <div class="bg-white rounded-xl shadow-lg p-6 max-w-md mb-4">- <h3 class="text-lg font-semibold mb-3">Level 1</h3>- <div class="bg-gray-50 rounded-lg shadow-sm p-4 mb-3">- <h4 class="font-medium mb-2">Level 2</h4>- <div class="bg-white rounded-md shadow-sm p-3">- <p class="text-sm">Level 3 — nesting inception.</p>- </div>- </div>- </div>-- <!-- CSS variant: border + bg + shadow nesting -->- <div style="background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); padding: 1.5rem; max-width: 28rem; margin-bottom: 1rem;">- <h3 style="font-weight: 600; margin-bottom: 0.75rem;">Outer (CSS)</h3>- <div style="background: #f9fafb; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 1rem;">- <p style="font-size: 0.875rem; color: #6b7280;">Inner card via CSS.</p>- </div>- </div>-- <!-- shadcn-style Card nesting (Card inside Card, not Card sub-components) -->- <div class="rounded-lg border bg-white shadow-sm p-6 max-w-md mb-4" data-component="card">- <h3 class="font-semibold mb-3">shadcn-style Outer Card</h3>- <div class="rounded-lg border bg-white shadow-sm p-4" data-component="card">- <p class="text-sm text-gray-600">Another shadcn Card nested inside — still bad.</p>- </div>- </div>-- <!-- ============================================================ -->- <!-- 2. IDENTICAL CARD GRIDS -->- <!-- ============================================================ -->- <h2>Identical Card Grid</h2>-- <!-- Classic: 4 identical cards with icon + heading + text -->- <div class="grid grid-cols-2 gap-4 max-w-2xl mb-4">- <div class="bg-white rounded-lg shadow-sm p-6">- <div class="w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center mb-4">- <svg class="w-6 h-6 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/></svg>- </div>- <h3 class="font-semibold mb-2">Fast Performance</h3>- <p class="text-sm text-gray-600">Lightning fast response times with optimized infrastructure.</p>- </div>- <div class="bg-white rounded-lg shadow-sm p-6">- <div class="w-12 h-12 bg-green-100 rounded-lg flex items-center justify-center mb-4">- <svg class="w-6 h-6 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>- </div>- <h3 class="font-semibold mb-2">Reliable Uptime</h3>- <p class="text-sm text-gray-600">99.99% uptime guarantee with automatic failover.</p>- </div>- <div class="bg-white rounded-lg shadow-sm p-6">- <div class="w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center mb-4">- <svg class="w-6 h-6 text-purple-600" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/></svg>- </div>- <h3 class="font-semibold mb-2">Bank-Level Security</h3>- <p class="text-sm text-gray-600">Enterprise-grade encryption and security controls.</p>- </div>- <div class="bg-white rounded-lg shadow-sm p-6">- <div class="w-12 h-12 bg-orange-100 rounded-lg flex items-center justify-center mb-4">- <svg class="w-6 h-6 text-orange-600" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"/></svg>- </div>- <h3 class="font-semibold mb-2">Team Collaboration</h3>- <p class="text-sm text-gray-600">Built for teams with real-time collaboration tools.</p>- </div>- </div>-- <!-- ============================================================ -->- <!-- 3. MONOTONOUS SPACING -->- <!-- ============================================================ -->- <h2>Monotonous Spacing</h2>-- <!-- Everything padded with the same value, same gaps -->- <div style="max-width: 28rem; margin-bottom: 1rem;">- <div style="background: white; padding: 16px; margin-bottom: 16px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);">- <h3 style="margin-bottom: 16px; font-weight: 600;">Section One</h3>- <p style="margin-bottom: 16px; font-size: 0.875rem; color: #6b7280;">Every margin and padding is exactly 16px.</p>- <div style="padding: 16px; background: #f3f4f6; border-radius: 8px;">- <p style="font-size: 0.875rem; color: #6b7280; margin-bottom: 16px;">Even the inner padding is 16px.</p>- </div>- </div>- <div style="background: white; padding: 16px; margin-bottom: 16px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);">- <h3 style="margin-bottom: 16px; font-weight: 600;">Section Two</h3>- <p style="margin-bottom: 16px; font-size: 0.875rem; color: #6b7280;">No rhythm, no variation, just 16px everywhere.</p>- </div>- </div>-- <!-- ============================================================ -->- <!-- 4. EVERYTHING CENTERED -->- <!-- ============================================================ -->- <h2>Everything Centered</h2>-- <div style="text-align: center; max-width: 32rem; margin: 0 auto 1rem;">- <h3 style="text-align: center; font-size: 1.25rem; font-weight: 700; margin-bottom: 1rem;">Welcome to Our Platform</h3>- <p style="text-align: center; color: #6b7280; margin-bottom: 1rem;">We provide the best solutions for your business needs.</p>- <div style="text-align: center; display: flex; gap: 1rem; justify-content: center; margin-bottom: 1rem;">- <button style="text-align: center; padding: 0.5rem 1rem; background: #3b82f6; color: white; border: none; border-radius: 6px;">Get Started</button>- <button style="text-align: center; padding: 0.5rem 1rem; background: white; color: #374151; border: 1px solid #d1d5db; border-radius: 6px;">Learn More</button>- </div>- <p style="text-align: center; font-size: 0.75rem; color: #9ca3af;">Trusted by over 10,000 companies worldwide.</p>- <div style="text-align: center; padding: 1rem; background: #f3f4f6; border-radius: 8px; margin-top: 1rem;">- <p style="text-align: center; font-size: 0.875rem; color: #6b7280;">Every. Single. Element. Is. Centered.</p>- </div>- </div>--<script src="/js/detect-antipatterns-browser.js"></script>-</body>-</html>diff --git a/tests/fixtures/antipatterns/layout-should-pass.html b/tests/fixtures/antipatterns/layout-should-pass.htmldeleted file mode 100644index 02a1c75ec..000000000--- a/tests/fixtures/antipatterns/layout-should-pass.html+++ /dev/null@@ -1,242 +0,0 @@-<!DOCTYPE html>-<html lang="en">-<head>- <meta charset="UTF-8">- <meta name="viewport" content="width=device-width, initial-scale=1.0">- <title>Layout — Clean Patterns (Should NOT Flag)</title>- <script src="https://cdn.tailwindcss.com"></script>- <style>- body { font-family: system-ui, sans-serif; background: #f9fafb; padding: 2rem; color: #111827; }- h1 { font-size: 2rem; margin-bottom: 0.5rem; }- h2 { font-size: 1.25rem; margin: 2.5rem 0 0.75rem; color: #6b7280; border-bottom: 1px solid #e5e7eb; padding-bottom: 0.5rem; }- p.intro { color: #6b7280; margin-bottom: 2rem; }- </style>-</head>-<body>- <h1>Layout — Should Pass</h1>- <p class="intro">All patterns here are legitimate. None should be flagged.</p>-- <!-- ============================================================ -->- <!-- shadcn-style Card sub-components (NOT nested cards) -->- <!-- ============================================================ -->- <h2>shadcn Card Sub-Components</h2>-- <!-- Card with CardHeader / CardContent / CardFooter structure -->- <div class="rounded-lg border bg-white shadow-sm max-w-md mb-4">- <div class="flex flex-col space-y-1.5 p-6">- <h3 class="text-lg font-semibold">Card Title</h3>- <p class="text-sm text-gray-500">Card description goes here.</p>- </div>- <div class="p-6 pt-0">- <p class="text-sm text-gray-600">This is CardContent — a sub-section, not a nested card. No shadow, no border-radius of its own.</p>- </div>- <div class="flex items-center p-6 pt-0">- <button class="px-4 py-2 bg-gray-900 text-white text-sm rounded-md">Action</button>- </div>- </div>-- <!-- ============================================================ -->- <!-- Card with form inputs (inputs have shadow/rounded) -->- <!-- ============================================================ -->- <h2>Card with Form Inputs</h2>-- <div class="bg-white rounded-lg shadow-sm p-6 max-w-md mb-4 border">- <h3 class="font-semibold mb-4">Settings</h3>- <div class="space-y-3">- <input type="text" placeholder="Name" class="w-full px-3 py-2 border rounded-md shadow-sm text-sm focus:outline-none focus:ring-2">- <input type="email" placeholder="Email" class="w-full px-3 py-2 border rounded-md shadow-sm text-sm focus:outline-none focus:ring-2">- <select class="w-full px-3 py-2 border rounded-md shadow-sm text-sm bg-white">- <option>Select option</option>- </select>- <textarea placeholder="Bio" class="w-full px-3 py-2 border rounded-md shadow-sm text-sm h-20 resize-none"></textarea>- </div>- </div>-- <!-- ============================================================ -->- <!-- Card with dropdown/popover (has shadow + rounded) -->- <!-- ============================================================ -->- <h2>Card with Dropdown</h2>-- <div class="bg-white rounded-lg shadow-sm p-6 max-w-md mb-4 border relative">- <h3 class="font-semibold mb-2">Select Plan</h3>- <p class="text-sm text-gray-600 mb-3">Choose your subscription tier.</p>- <!-- Simulated dropdown menu -->- <div class="absolute top-full left-6 mt-1 w-48 bg-white rounded-md shadow-lg border py-1 z-10">- <div class="px-3 py-2 text-sm hover:bg-gray-50 cursor-pointer">Free</div>- <div class="px-3 py-2 text-sm hover:bg-gray-50 cursor-pointer">Pro</div>- <div class="px-3 py-2 text-sm hover:bg-gray-50 cursor-pointer">Enterprise</div>- </div>- </div>-- <div style="height: 80px;"></div> <!-- spacer for dropdown -->-- <!-- ============================================================ -->- <!-- Card with code block inside -->- <!-- ============================================================ -->- <h2>Card with Code Block</h2>-- <div class="bg-white rounded-lg shadow-sm p-6 max-w-md mb-4 border">- <h3 class="font-semibold mb-3">Installation</h3>- <pre class="bg-gray-900 text-gray-100 rounded-md p-4 text-sm overflow-x-auto"><code>npm install @acme/sdk</code></pre>- </div>-- <!-- ============================================================ -->- <!-- Card with badge/chip inside -->- <!-- ============================================================ -->- <h2>Card with Badges</h2>-- <div class="bg-white rounded-lg shadow-sm p-6 max-w-md mb-4 border">- <h3 class="font-semibold mb-3">Tags</h3>- <div class="flex flex-wrap gap-2">- <span class="px-2 py-1 bg-blue-100 text-blue-700 rounded-full text-xs font-medium">React</span>- <span class="px-2 py-1 bg-green-100 text-green-700 rounded-full text-xs font-medium">TypeScript</span>- <span class="px-2 py-1 bg-purple-100 text-purple-700 rounded-full text-xs font-medium">Tailwind</span>- </div>- </div>-- <!-- ============================================================ -->- <!-- Card with accordion/collapsible inside -->- <!-- ============================================================ -->- <h2>Card with Accordion</h2>-- <div class="bg-white rounded-lg shadow-sm max-w-md mb-4 border">- <div class="p-4 border-b cursor-pointer flex justify-between items-center">- <span class="font-medium text-sm">How does billing work?</span>- <span class="text-gray-400">+</span>- </div>- <div class="p-4 border-b cursor-pointer flex justify-between items-center">- <span class="font-medium text-sm">Can I cancel anytime?</span>- <span class="text-gray-400">+</span>- </div>- <div class="p-4 cursor-pointer flex justify-between items-center">- <span class="font-medium text-sm">Do you offer refunds?</span>- <span class="text-gray-400">+</span>- </div>- </div>-- <!-- ============================================================ -->- <!-- Card with image (rounded + shadow on image) -->- <!-- ============================================================ -->- <h2>Card with Styled Image</h2>-- <div class="bg-white rounded-lg shadow-sm p-6 max-w-md mb-4 border">- <div class="w-full h-40 bg-gradient-to-br from-blue-400 to-purple-500 rounded-lg shadow-inner mb-4"></div>- <h3 class="font-semibold">Project Preview</h3>- <p class="text-sm text-gray-600 mt-1">Image placeholder with rounded corners and shadow.</p>- </div>-- <!-- ============================================================ -->- <!-- Card with tab panels inside -->- <!-- ============================================================ -->- <h2>Card with Tabs</h2>-- <div class="bg-white rounded-lg shadow-sm max-w-md mb-4 border">- <div class="flex border-b">- <button class="px-4 py-3 text-sm font-medium text-blue-600 border-b-2 border-blue-600">Overview</button>- <button class="px-4 py-3 text-sm text-gray-500">Analytics</button>- <button class="px-4 py-3 text-sm text-gray-500">Settings</button>- </div>- <div class="p-6">- <p class="text-sm text-gray-600">Tab content area — structured content inside a card, not a nested card.</p>- </div>- </div>-- <!-- ============================================================ -->- <!-- Pricing cards (similar but intentionally comparative) -->- <!-- ============================================================ -->- <h2>Pricing Cards (Intentionally Similar)</h2>-- <div class="grid grid-cols-3 gap-4 max-w-3xl mb-4">- <div class="bg-white rounded-lg shadow-sm p-6 border">- <h3 class="font-semibold mb-1">Free</h3>- <div class="text-2xl font-bold mb-4">$0</div>- <ul class="space-y-2 text-sm text-gray-600">- <li>5 projects</li>- <li>1 GB storage</li>- <li>Community support</li>- </ul>- </div>- <div class="bg-white rounded-lg shadow-sm p-6 border-2 border-blue-500">- <h3 class="font-semibold mb-1">Pro</h3>- <div class="text-2xl font-bold mb-4">$29</div>- <ul class="space-y-2 text-sm text-gray-600">- <li>Unlimited projects</li>- <li>50 GB storage</li>- <li>Priority support</li>- </ul>- </div>- <div class="bg-white rounded-lg shadow-sm p-6 border">- <h3 class="font-semibold mb-1">Enterprise</h3>- <div class="text-2xl font-bold mb-4">Custom</div>- <ul class="space-y-2 text-sm text-gray-600">- <li>Everything in Pro</li>- <li>Unlimited storage</li>- <li>Dedicated support</li>- </ul>- </div>- </div>-- <!-- ============================================================ -->- <!-- Good spacing variety -->- <!-- ============================================================ -->- <h2>Varied Spacing (Good Rhythm)</h2>-- <div style="max-width: 28rem; margin-bottom: 1rem;">- <div style="background: white; padding: 2rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 2rem;">- <h3 style="font-weight: 600; margin-bottom: 0.5rem; font-size: 1.25rem;">Heading with tight spacing</h3>- <p style="font-size: 0.875rem; color: #6b7280; margin-bottom: 1.5rem;">Body text with medium spacing below.</p>- <div style="padding: 1rem; background: #f3f4f6; border-radius: 6px;">- <p style="font-size: 0.8125rem; color: #6b7280;">Nested content with different padding.</p>- </div>- </div>- <div style="background: white; padding: 1.5rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);">- <h3 style="font-weight: 600; margin-bottom: 0.75rem;">Another section</h3>- <p style="font-size: 0.875rem; color: #6b7280;">Different padding than above — intentional rhythm.</p>- </div>- </div>-- <!-- ============================================================ -->- <!-- Centered hero section (legitimately centered) -->- <!-- ============================================================ -->- <h2>Centered Hero (Legitimate)</h2>-- <div style="text-align: center; max-width: 32rem; margin: 0 auto 1rem; padding: 2rem 0;">- <h3 style="font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem;">Hero Heading</h3>- <p style="color: #6b7280; margin-bottom: 1.5rem;">A centered hero section is fine — it's the rest of the page that shouldn't all be centered too.</p>- <button style="padding: 0.75rem 1.5rem; background: #111827; color: white; border: none; border-radius: 6px; font-weight: 500;">Get Started</button>- </div>-- <!-- Left-aligned content following the hero -->- <div style="max-width: 32rem; margin-bottom: 1rem;">- <h3 style="font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem;">Features</h3>- <p style="color: #6b7280; margin-bottom: 1rem;">This content is left-aligned, creating contrast with the centered hero above.</p>- <ul style="color: #4b5563; font-size: 0.875rem; padding-left: 1.25rem; list-style: disc;">- <li style="margin-bottom: 0.5rem;">Left-aligned list items</li>- <li style="margin-bottom: 0.5rem;">Natural reading direction</li>- <li>Intentional layout variety</li>- </ul>- </div>-- <!-- ============================================================ -->- <!-- Non-card grid (varied structure) -->- <!-- ============================================================ -->- <h2>Grid with Varied Card Structures</h2>-- <div class="grid grid-cols-2 gap-4 max-w-2xl mb-4">- <div class="bg-white rounded-lg shadow-sm p-6 border col-span-2">- <h3 class="font-semibold text-lg mb-2">Featured Item</h3>- <p class="text-sm text-gray-600">This card spans the full width — different from the others.</p>- </div>- <div class="bg-white rounded-lg shadow-sm p-4 border">- <h3 class="font-semibold text-sm">Compact Card</h3>- <p class="text-xs text-gray-500 mt-1">Smaller, less padding.</p>- </div>- <div class="bg-blue-50 rounded-lg p-4 border border-blue-200">- <h3 class="font-semibold text-sm text-blue-900">Highlighted</h3>- <p class="text-xs text-blue-700 mt-1">Different bg, no shadow — visual variety.</p>- </div>- </div>--<script src="/js/detect-antipatterns-browser.js"></script>-</body>-</html>diff --git a/tests/fixtures/antipatterns/layout.html b/tests/fixtures/antipatterns/layout.htmlnew file mode 100644index 000000000..711f2ea7a--- /dev/null+++ b/tests/fixtures/antipatterns/layout.html@@ -0,0 +1,138 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Layout Anti-Patterns — Should Flag vs Should Pass</title>+ <script src="https://cdn.tailwindcss.com"></script>+ <style>+ body { font-family: system-ui, sans-serif; background: #f9fafb; padding: 24px; margin: 0; color: #111827; }+ .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; max-width: 1280px; margin: 0 auto; }+ .col h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 16px; color: #475569; }+ .col h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin: 24px 0 8px; color: #64748b; }+ </style>+</head>+<body>+ <div class="grid">++ <!-- ════════════════════════════════════════════════════════════+ LEFT COLUMN: should flag+ ═══════════════════════════════════════════════════════════ -->+ <div class="col" data-col="flag">+ <h2>Should flag</h2>++ <h3>Nested cards (cardocalypse)</h3>++ <!-- Classic: card inside card -->+ <div class="bg-white rounded-lg shadow-md p-6 mb-4">+ <h4 class="text-lg font-semibold mb-3">Outer Card</h4>+ <div class="bg-white rounded-lg shadow-md p-4">+ <h5 class="font-medium">Inner Card</h5>+ <p class="text-sm text-gray-600">Card inside card.</p>+ </div>+ </div>++ <!-- Three levels deep -->+ <div class="bg-white rounded-xl shadow-lg p-6 mb-4">+ <h4 class="text-lg font-semibold mb-3">Level 1</h4>+ <div class="bg-gray-50 rounded-lg shadow-sm p-4 mb-3">+ <h5 class="font-medium mb-2">Level 2</h5>+ <div class="bg-white rounded-md shadow-sm p-3">+ <p class="text-sm">Level 3 — nesting inception.</p>+ </div>+ </div>+ </div>++ <!-- CSS variant: border + bg + shadow nesting -->+ <div style="background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); padding: 1.5rem; margin-bottom: 1rem;">+ <h4 style="font-weight: 600; margin-bottom: 0.75rem;">Outer (CSS)</h4>+ <div style="background: #f9fafb; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 1rem;">+ <p style="font-size: 0.875rem; color: #6b7280;">Inner card via CSS.</p>+ </div>+ </div>++ <!-- shadcn-style Card nested in Card -->+ <div class="rounded-lg border bg-white shadow-sm p-6 mb-4" data-component="card">+ <h4 class="font-semibold mb-3">shadcn-style Outer Card</h4>+ <div class="rounded-lg border bg-white shadow-sm p-4" data-component="card">+ <p class="text-sm text-gray-600">Another shadcn Card nested inside.</p>+ </div>+ </div>+ </div>++ <!-- ════════════════════════════════════════════════════════════+ RIGHT COLUMN: should pass+ ═══════════════════════════════════════════════════════════ -->+ <div class="col" data-col="pass">+ <h2>Should pass</h2>++ <h3>shadcn Card sub-components (not nested cards)</h3>+ <div class="rounded-lg border bg-white shadow-sm mb-4">+ <div class="flex flex-col space-y-1.5 p-6">+ <h4 class="text-lg font-semibold">Card Title</h4>+ <p class="text-sm text-gray-500">Card description goes here.</p>+ </div>+ <div class="p-6 pt-0">+ <p class="text-sm text-gray-600">CardContent — a sub-section, not a nested card. No shadow, no border-radius of its own.</p>+ </div>+ <div class="flex items-center p-6 pt-0">+ <button class="px-4 py-2 bg-gray-900 text-white text-sm rounded-md">Action</button>+ </div>+ </div>++ <h3>Card with form inputs</h3>+ <div class="bg-white rounded-lg shadow-sm p-6 mb-4 border">+ <h4 class="font-semibold mb-4">Settings</h4>+ <div class="space-y-3">+ <input type="text" placeholder="Name" class="w-full px-3 py-2 border rounded-md shadow-sm text-sm">+ <input type="email" placeholder="Email" class="w-full px-3 py-2 border rounded-md shadow-sm text-sm">+ <select class="w-full px-3 py-2 border rounded-md shadow-sm text-sm bg-white">+ <option>Select option</option>+ </select>+ <textarea placeholder="Bio" class="w-full px-3 py-2 border rounded-md shadow-sm text-sm h-20 resize-none"></textarea>+ </div>+ </div>++ <h3>Card with code block</h3>+ <div class="bg-white rounded-lg shadow-sm p-6 mb-4 border">+ <h4 class="font-semibold mb-3">Installation</h4>+ <pre class="bg-gray-900 text-gray-100 rounded-md p-4 text-sm overflow-x-auto"><code>npm install @acme/sdk</code></pre>+ </div>++ <h3>Card with badges</h3>+ <div class="bg-white rounded-lg shadow-sm p-6 mb-4 border">+ <h4 class="font-semibold mb-3">Tags</h4>+ <div class="flex flex-wrap gap-2">+ <span class="px-2 py-1 bg-blue-100 text-blue-700 rounded-full text-xs font-medium">React</span>+ <span class="px-2 py-1 bg-green-100 text-green-700 rounded-full text-xs font-medium">TypeScript</span>+ <span class="px-2 py-1 bg-purple-100 text-purple-700 rounded-full text-xs font-medium">Tailwind</span>+ </div>+ </div>++ <h3>Card with image</h3>+ <div class="bg-white rounded-lg shadow-sm p-6 mb-4 border">+ <div class="w-full h-32 bg-gradient-to-br from-amber-400 to-rose-500 rounded-lg shadow-inner mb-4"></div>+ <h4 class="font-semibold">Project Preview</h4>+ <p class="text-sm text-gray-600 mt-1">Image with rounded corners and shadow.</p>+ </div>++ <h3>Pricing cards (intentionally similar)</h3>+ <div class="grid grid-cols-3 gap-2 mb-4">+ <div class="bg-white rounded-lg shadow-sm p-4 border">+ <h4 class="font-semibold mb-1 text-sm">Free</h4>+ <div class="text-lg font-bold mb-2">$0</div>+ </div>+ <div class="bg-white rounded-lg shadow-sm p-4 border-2 border-blue-500">+ <h4 class="font-semibold mb-1 text-sm">Pro</h4>+ <div class="text-lg font-bold mb-2">$29</div>+ </div>+ <div class="bg-white rounded-lg shadow-sm p-4 border">+ <h4 class="font-semibold mb-1 text-sm">Enterprise</h4>+ <div class="text-lg font-bold mb-2">Custom</div>+ </div>+ </div>+ </div>+ </div>+ <script src="/js/detect-antipatterns-browser.js"></script>+</body>+</html>diff --git a/tests/fixtures/antipatterns/motion-should-flag.html b/tests/fixtures/antipatterns/motion-should-flag.htmldeleted file mode 100644index d53825d7c..000000000--- a/tests/fixtures/antipatterns/motion-should-flag.html+++ /dev/null@@ -1,118 +0,0 @@-<!DOCTYPE html>-<html lang="en">-<head>- <meta charset="UTF-8">- <meta name="viewport" content="width=device-width, initial-scale=1.0">- <title>Motion Anti-Patterns That Should Be Flagged</title>- <style>- body { font-family: system-ui, sans-serif; background: #f9fafb; padding: 2rem; }- h1 { font-size: 2rem; margin-bottom: 0.5rem; }- h2 { font-size: 1.125rem; margin: 2.5rem 0 0.75rem; color: #6b7280; border-bottom: 1px solid #e5e7eb; padding-bottom: 0.5rem; }- p.intro { color: #6b7280; margin-bottom: 2rem; max-width: 36rem; font-size: 0.875rem; }- .demo { max-width: 28rem; margin-bottom: 1rem; padding: 1rem; background: white; border-radius: 0.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }- .demo h3 { font-weight: 600; font-size: 0.875rem; }- .demo p { font-size: 0.8125rem; color: #6b7280; margin-top: 0.25rem; }-- /* Bounce easing */- @keyframes bounce {- 0%, 100% { transform: translateY(0); }- 50% { transform: translateY(-10px); }- }- .bounce-animation {- animation: bounce 1s infinite;- }-- /* Elastic cubic-bezier (overshoot) */- .elastic-transition {- transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);- }-- /* Layout property transitions */- .width-transition {- transition: width 0.3s ease;- }- .height-transition {- transition: height 0.4s ease-out;- }- .padding-transition {- transition: padding 0.2s linear;- }- .margin-transition {- transition: margin 0.3s ease-in;- }- .max-height-transition {- transition: max-height 0.5s ease;- }- .multi-layout-transition {- transition: width 0.3s ease, height 0.3s ease;- }- .mixed-transition {- transition: width 0.3s ease, opacity 0.3s ease;- }- .transition-property-width {- transition-property: width;- transition-duration: 0.3s;- }- </style>-</head>-<body>- <h1>Motion Anti-Patterns: Should Flag</h1>- <p class="intro">Every example on this page should be detected by the motion anti-pattern scanner.</p>-- <h2>Bounce / Elastic Easing</h2>-- <div class="demo bounce-animation">- <h3>CSS bounce animation</h3>- <p>animation: bounce 1s infinite</p>- </div>-- <div class="demo elastic-transition">- <h3>Elastic cubic-bezier</h3>- <p>cubic-bezier(0.68, -0.55, 0.265, 1.55)</p>- </div>-- <h2>Layout Property Transitions</h2>-- <div class="demo width-transition">- <h3>transition: width</h3>- <p>Animating width causes layout thrash.</p>- </div>-- <div class="demo height-transition">- <h3>transition: height</h3>- <p>Animating height causes layout thrash.</p>- </div>-- <div class="demo padding-transition">- <h3>transition: padding</h3>- <p>Animating padding causes layout thrash.</p>- </div>-- <div class="demo margin-transition">- <h3>transition: margin</h3>- <p>Animating margin causes layout thrash.</p>- </div>-- <div class="demo max-height-transition">- <h3>transition: max-height</h3>- <p>Use grid-template-rows instead.</p>- </div>-- <div class="demo multi-layout-transition">- <h3>transition: width, height</h3>- <p>Multiple layout properties.</p>- </div>-- <div class="demo mixed-transition">- <h3>transition: width, opacity</h3>- <p>Layout property mixed with OK property.</p>- </div>-- <div class="demo transition-property-width">- <h3>transition-property: width</h3>- <p>Longhand form.</p>- </div>--<script src="/js/detect-antipatterns-browser.js"></script>-</body>-</html>diff --git a/tests/fixtures/antipatterns/motion-should-pass.html b/tests/fixtures/antipatterns/motion-should-pass.htmldeleted file mode 100644index d8d2568b6..000000000--- a/tests/fixtures/antipatterns/motion-should-pass.html+++ /dev/null@@ -1,109 +0,0 @@-<!DOCTYPE html>-<html lang="en">-<head>- <meta charset="UTF-8">- <meta name="viewport" content="width=device-width, initial-scale=1.0">- <title>Motion Patterns That Should Pass</title>- <style>- body { font-family: system-ui, sans-serif; background: #f9fafb; padding: 2rem; }- h1 { font-size: 2rem; margin-bottom: 0.5rem; }- h2 { font-size: 1.125rem; margin: 2.5rem 0 0.75rem; color: #6b7280; border-bottom: 1px solid #e5e7eb; padding-bottom: 0.5rem; }- p.intro { color: #6b7280; margin-bottom: 2rem; max-width: 36rem; font-size: 0.875rem; }- .demo { max-width: 28rem; margin-bottom: 1rem; padding: 1rem; background: white; border-radius: 0.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }- .demo h3 { font-weight: 600; font-size: 0.875rem; }- .demo p { font-size: 0.8125rem; color: #6b7280; margin-top: 0.25rem; }-- /* Good easing — smooth exponential deceleration */- @keyframes fadeIn {- from { opacity: 0; transform: translateY(8px); }- to { opacity: 1; transform: translateY(0); }- }- .fade-in {- animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);- }-- /* Good transitions — transform and opacity only */- .transform-transition {- transition: transform 0.3s ease-out;- }- .opacity-transition {- transition: opacity 0.2s ease;- }- .color-transition {- transition: color 0.15s ease, background-color 0.15s ease;- }- .shadow-transition {- transition: box-shadow 0.2s ease;- }- .all-transition {- transition: all 0.3s ease;- }- .multi-safe-transition {- transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.2s ease;- }-- /* Standard easing curves (y values within [0, 1]) */- .ease-out-quart {- transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);- }- .ease-out-expo {- transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);- }- </style>-</head>-<body>- <h1>Motion Patterns: Should Pass</h1>- <p class="intro">None of these should trigger motion anti-pattern warnings.</p>-- <h2>Good Easing</h2>-- <div class="demo fade-in">- <h3>Smooth fade in</h3>- <p>animation: fadeIn with exponential ease-out</p>- </div>-- <div class="demo ease-out-quart">- <h3>Ease-out quart</h3>- <p>cubic-bezier(0.25, 1, 0.5, 1) — smooth deceleration</p>- </div>-- <div class="demo ease-out-expo">- <h3>Ease-out expo</h3>- <p>cubic-bezier(0.16, 1, 0.3, 1) — natural feel</p>- </div>-- <h2>Good Transitions (transform/opacity/color only)</h2>-- <div class="demo transform-transition">- <h3>transition: transform</h3>- <p>Transform is GPU-accelerated and safe.</p>- </div>-- <div class="demo opacity-transition">- <h3>transition: opacity</h3>- <p>Opacity is GPU-accelerated and safe.</p>- </div>-- <div class="demo color-transition">- <h3>transition: color, background-color</h3>- <p>Color transitions are paint-only, no layout.</p>- </div>-- <div class="demo shadow-transition">- <h3>transition: box-shadow</h3>- <p>Shadow transitions are paint-only.</p>- </div>-- <div class="demo all-transition">- <h3>transition: all</h3>- <p>Too common to flag — might include layout but usually paired with transform/opacity.</p>- </div>-- <div class="demo multi-safe-transition">- <h3>transition: transform, opacity, box-shadow</h3>- <p>Multiple safe properties combined.</p>- </div>--<script src="/js/detect-antipatterns-browser.js"></script>-</body>-</html>diff --git a/tests/fixtures/antipatterns/motion.html b/tests/fixtures/antipatterns/motion.htmlnew file mode 100644index 000000000..910801abe--- /dev/null+++ b/tests/fixtures/antipatterns/motion.html@@ -0,0 +1,160 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Motion Anti-Patterns — Should Flag vs Should Pass</title>+ <style>+ /* ─── Two-column fixture convention ─────────────────────────────+ Left column = should flag. Right column = should pass.+ Tests assert (a) every flag-column rule fires and (b) the total+ finding count matches the number of flag cases (no false+ positives leaking from the pass column).+ ──────────────────────────────────────────────────────────── */+ body { font-family: system-ui, sans-serif; background: #f9fafb; padding: 24px; margin: 0; }+ .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; max-width: 1200px; margin: 0 auto; }+ .col h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 16px; color: #475569; }+ .col h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin: 24px 0 8px; color: #64748b; }+ .demo { padding: 14px 16px; background: white; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 10px; }+ .demo h4 { font-weight: 600; font-size: 13px; margin: 0; }+ .demo p { font-size: 12px; color: #6b7280; margin: 4px 0 0; }++ /* ── FLAG: bounce / elastic easing ── */+ @keyframes bounce-keyframe {+ 0%, 100% { transform: translateY(0); }+ 50% { transform: translateY(-10px); }+ }+ .bounce-animation { animation: bounce-keyframe 1s infinite; }+ .elastic-transition { transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55); }++ /* ── FLAG: layout property transitions ── */+ .width-transition { transition: width 0.3s ease; }+ .height-transition { transition: height 0.4s ease-out; }+ .padding-transition { transition: padding 0.2s linear; }+ .margin-transition { transition: margin 0.3s ease-in; }+ .max-height-transition { transition: max-height 0.5s ease; }+ .multi-layout-transition { transition: width 0.3s ease, height 0.3s ease; }+ .mixed-transition { transition: width 0.3s ease, opacity 0.3s ease; }+ .transition-property-width { transition-property: width; transition-duration: 0.3s; }++ /* ── PASS: good easing ── */+ @keyframes fade-in-keyframe {+ from { opacity: 0; transform: translateY(8px); }+ to { opacity: 1; transform: translateY(0); }+ }+ .fade-in-good { animation: fade-in-keyframe 0.4s cubic-bezier(0.16, 1, 0.3, 1); }+ .ease-out-quart { transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1); }+ .ease-out-expo { transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1); }++ /* ── PASS: safe transitions ── */+ .transform-transition { transition: transform 0.3s ease-out; }+ .opacity-transition { transition: opacity 0.2s ease; }+ .color-transition { transition: color 0.15s ease, background-color 0.15s ease; }+ .shadow-transition { transition: box-shadow 0.2s ease; }+ .all-transition { transition: all 0.3s ease; }+ .multi-safe-transition { transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.2s ease; }+ </style>+</head>+<body>+ <div class="grid">+ <!-- ════════════════════════════════════════════════════════════+ LEFT COLUMN: should flag+ ═══════════════════════════════════════════════════════════ -->+ <div class="col" data-col="flag">+ <h2>Should flag</h2>++ <h3>Bounce / elastic easing</h3>+ <div class="demo bounce-animation">+ <h4>CSS bounce animation</h4>+ <p>animation: bounce 1s infinite</p>+ </div>+ <div class="demo elastic-transition">+ <h4>Elastic cubic-bezier</h4>+ <p>cubic-bezier(0.68, -0.55, 0.265, 1.55)</p>+ </div>++ <h3>Layout property transitions</h3>+ <div class="demo width-transition">+ <h4>transition: width</h4>+ <p>Animating width causes layout thrash.</p>+ </div>+ <div class="demo height-transition">+ <h4>transition: height</h4>+ <p>Animating height causes layout thrash.</p>+ </div>+ <div class="demo padding-transition">+ <h4>transition: padding</h4>+ <p>Animating padding causes layout thrash.</p>+ </div>+ <div class="demo margin-transition">+ <h4>transition: margin</h4>+ <p>Animating margin causes layout thrash.</p>+ </div>+ <div class="demo max-height-transition">+ <h4>transition: max-height</h4>+ <p>Use grid-template-rows instead.</p>+ </div>+ <div class="demo multi-layout-transition">+ <h4>transition: width, height</h4>+ <p>Multiple layout properties.</p>+ </div>+ <div class="demo mixed-transition">+ <h4>transition: width, opacity</h4>+ <p>Layout property mixed with OK property.</p>+ </div>+ <div class="demo transition-property-width">+ <h4>transition-property: width</h4>+ <p>Longhand form.</p>+ </div>+ </div>++ <!-- ════════════════════════════════════════════════════════════+ RIGHT COLUMN: should pass+ ═══════════════════════════════════════════════════════════ -->+ <div class="col" data-col="pass">+ <h2>Should pass</h2>++ <h3>Good easing</h3>+ <div class="demo fade-in-good">+ <h4>Smooth fade in</h4>+ <p>animation: fadeIn with exponential ease-out</p>+ </div>+ <div class="demo ease-out-quart">+ <h4>Ease-out quart</h4>+ <p>cubic-bezier(0.25, 1, 0.5, 1) — smooth deceleration</p>+ </div>+ <div class="demo ease-out-expo">+ <h4>Ease-out expo</h4>+ <p>cubic-bezier(0.16, 1, 0.3, 1) — natural feel</p>+ </div>++ <h3>Safe transitions (transform / opacity / color only)</h3>+ <div class="demo transform-transition">+ <h4>transition: transform</h4>+ <p>Transform is GPU-accelerated and safe.</p>+ </div>+ <div class="demo opacity-transition">+ <h4>transition: opacity</h4>+ <p>Opacity is GPU-accelerated and safe.</p>+ </div>+ <div class="demo color-transition">+ <h4>transition: color, background-color</h4>+ <p>Color transitions are paint-only, no layout.</p>+ </div>+ <div class="demo shadow-transition">+ <h4>transition: box-shadow</h4>+ <p>Shadow transitions are paint-only.</p>+ </div>+ <div class="demo all-transition">+ <h4>transition: all</h4>+ <p>Too common to flag — usually paired with transform/opacity.</p>+ </div>+ <div class="demo multi-safe-transition">+ <h4>transition: transform, opacity, box-shadow</h4>+ <p>Multiple safe properties combined.</p>+ </div>+ </div>+ </div>+ <script src="/js/detect-antipatterns-browser.js"></script>+</body>+</html>