From 4867ad2d6c94ecc8f933986fdba579fc425835d4 Mon Sep 17 00:00:00 2001 From: Sergey Kozyrenko Date: Sat, 25 Jul 2026 03:53:54 +0700 Subject: [PATCH] test(e2e): make the palette gate see absolute colours PALETTE_UTILITY matched only numbered hues and arbitrary values, so text-white, text-black and bg-transparent were invisible to it: an overlay like `cn(badgeVariants({variant:'blue'}), 'text-white')` on a badge went unmeasured. Add white/black/transparent (with optional opacity) to the colour alternation. No badge or button variant uses them, so all 18 scans stay green; injecting a text-white overlay on a rendered badge now fails the gate as an off-palette node. Co-Authored-By: Claude Opus 4.8 --- frontend/e2e/specs/cross/palette.spec.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/e2e/specs/cross/palette.spec.ts b/frontend/e2e/specs/cross/palette.spec.ts index 027e6348..9ead8712 100644 --- a/frontend/e2e/specs/cross/palette.spec.ts +++ b/frontend/e2e/specs/cross/palette.spec.ts @@ -26,10 +26,11 @@ const BADGE_VARIANTS = Object.keys({ const BUTTON_VARIANTS = ['default', 'destructive', 'ghost', 'link', 'outline', 'secondary'] as const; -// A hard-coded hue (`text-green-800`, `bg-[#16a34a]`) rather than a semantic token -// (`bg-primary`, `text-muted-foreground`) or a non-colour utility (`text-xs`). +// A hard-coded colour (`text-green-800`, `bg-[#16a34a]`, `text-white`) rather than a semantic token +// (`bg-primary`, `text-muted-foreground`) or a non-colour utility (`text-xs`). white/black/transparent +// are absolute too: an overlay like `text-white` on a coloured badge is off-palette, not a token. const PALETTE_UTILITY = - /^(?:[a-z-]+:)*(?:bg|text|border|ring|from|via|to|fill|stroke|shadow|outline|decoration|divide|accent|caret|placeholder)-(?:\[[^\]]*\]|(?: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}(?:\/\d{1,3})?)$/; + /^(?:[a-z-]+:)*(?:bg|text|border|ring|from|via|to|fill|stroke|shadow|outline|decoration|divide|accent|caret|placeholder)-(?:white|black|transparent|\[[^\]]*\]|(?: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})(?:\/\d{1,3})?$/; /** * Per-variant, not one union: a flat union sanctions every variant's hue on every badge and button,