import { describe, it, expect } from 'vitest'; import { readFileSync } from 'fs'; import path from 'path'; import { BUILTIN_THEMES } from '@/lib/builtin-themes'; /** * The browser paints a native option colours (#999)', () => { it('pins option backgrounds and text to the popover tokens', () => { const body = ruleBody('option'); expect(body).toMatch(/background-color:\s*var\(--color-popover\)/); expect(body).toMatch(/(?:^|[^-])color:\s*var\(--color-popover-foreground\)/); }); it('pins the group labels to the popover tokens too', () => { const body = ruleBody('optgroup'); expect(body).toMatch(/background-color:\s*var\(--color-popover\)/); expect(body).toMatch(/(?:^|[^-])color:\s*var\(--color-popover-foreground\)/); }); it('asks the browser for a dark popup in dark mode', () => { expect(ruleBody('.dark select')).toMatch(/color-scheme:\s*dark/); }); it('keeps the base light and dark popover surfaces opaque', () => { const values = popoverValues(css); expect(values.length).toBeGreaterThanOrEqual(2); for (const v of values) expect(isOpaque(v), `globals.css --color-popover: ${v}`).toBe(true); }); it.each(BUILTIN_THEMES.map((t) => [t.name, t] as const))( '%s defines an opaque popover in every variant', (_name, theme) => { const values = popoverValues(theme.css); expect(values.length, 'theme css should set --color-popover').toBeGreaterThanOrEqual( theme.variants.length ); for (const v of values) expect(isOpaque(v), `--color-popover: ${v}`).toBe(true); } ); });