import { describe, it, expect } from 'vitest' import { exportPage } from '@/lib/exporter/html' import { pageSchema, type Page } from '@/lib/schema/page' function makePage(): Page { return pageSchema.parse({ title: 'Dark Contrast Hover', locale: 'en', theme: { primaryColor: '#2563eb', fontFamily: 'Inter' }, sections: [ { type: 'hero', props: { heading: 'Welcome', subheading: 'Sub', imageUrl: 'https://img.example/h.png' } }, { type: 'cta', props: { text: 'Call', href: '#' } }, ], form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } }, seo: { title: 't', description: 'd' }, }) } describe('Exporter - dark mode hover/cta tokens', () => { it('adds link hover underline and ensures btn-cta readable in dark', () => { const out = exportPage(makePage()) const css = out.css // underline on hover for links in dark for clearer affordance expect(css).toMatch(/@media \(prefers-color-scheme: dark\)[\s\S]*a:hover\{[^}]*text-decoration:underline/i) // btn-cta has readable foreground/background in dark expect(css).toMatch(/@media \(prefers-color-scheme: dark\)[\s\S]*\.btn-cta\{[^}]*background:[^;]+;[^}]*color:#fff/i) }) })