import { describe, expect, test } from 'vitest' import { exportPage } from './html' import { pageSchema, type Page } from '@/lib/schema/page' const makePage = (): Page => pageSchema.parse({ title: 'Snapshot', locale: 'en', theme: { primaryColor: '#0ea5e9', fontFamily: 'Inter' }, sections: [ { type: 'hero', props: { heading: 'Welcome', subheading: 'Sub', imageUrl: 'https://example.com/hero.png' } }, { type: 'features', props: { items: ['One', 'Two'] } }, { type: 'testimonials', props: { items: [{ author: 'Jane', quote: 'Great' }] } }, { type: 'faq', props: { items: [{ q: 'Q1', a: 'A1' }] } }, { type: 'cta', props: { text: 'Go', href: '#' } }, ] as Page['sections'], form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } }, seo: { title: 'SEO', description: 'Desc' }, analytics: { ga4MeasurementId: '', metaPixelId: '', customHeadHtml: '' }, }) describe('Exporter regression snapshot (markers only)', () => { test('combined markers for headings/aria/responsive exist', () => { const out = exportPage(makePage()) const { html, css } = out // headings/aria markers expect(html).toContain('

Welcome

') expect(html).toContain('
') expect(html).toContain('

') expect(html).toContain('
') expect(html).toContain('

') expect(html).toContain('
') expect(html).toContain('

') expect(html).toContain('
') expect(html).toContain('

') // responsive/a11y CSS markers expect(css).toMatch(/@media \(max-width: 640px\)/) expect(css).toMatch(/@media \(prefers-reduced-motion: reduce\)/) expect(css).toMatch(/a\.skip-link:focus/) expect(css).toMatch(/outline:\s*3px\s*solid/) }) })