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', locale: 'en', theme: { primaryColor: '#2563eb', fontFamily: 'Inter' }, sections: [ { type: 'hero', props: { heading: 'Welcome', subheading: 'Sub', imageUrl: 'https://img.example/h.png' } }, { type: 'faq', props: { items: [{ q: 'Q', a: 'A' }] } }, { type: 'cta', props: { text: 'Go', href: '#' } }, ], form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } }, seo: { title: 't', description: 'd' }, }) } describe('Exporter - dark mode contrast tokens', () => { it('includes dark mode tokens that improve contrast for links/buttons/faq text', () => { const out = exportPage(makePage()) const css = out.css // dark mode block exists expect(css).toMatch(/@media \(prefers-color-scheme: dark\)/) // link color token in dark expect(css).toMatch(/@media \(prefers-color-scheme: dark\)[\s\S]*a\{[^}]*color:#93c5fd/i) // button keeps readable foreground/background in dark expect(css).toMatch(/@media \(prefers-color-scheme: dark\)[\s\S]*button\{[^}]*background:[^;]+;[^}]*color:#fff/i) // faq answer text brighter in dark expect(css).toMatch(/@media \(prefers-color-scheme: dark\)[\s\S]*\.faq-a\{[^}]*color:#cbd5e1/i) }) })