Files
landing-builder/lib/exporter/sectionA11y.template.test.ts
T

29 lines
1.2 KiB
TypeScript

import { describe, it } from 'vitest'
import { pageSchema, type Page } from '@/lib/schema/page'
import { exportPage } from '@/lib/exporter/html'
import { assertSectionA11y } from '@/lib/exporter/testUtils/sectionA11y'
function makeFullPage(): Page {
return pageSchema.parse({
title: 'A11y Template',
locale: 'en',
theme: { primaryColor: '#0ea5e9', fontFamily: 'Inter' },
sections: [
{ type: 'hero', props: { heading: 'Welcome', subheading: '', imageUrl: 'https://via.placeholder.com/800x400' } },
{ type: 'features', props: { items: ['A','B','C'] } },
{ type: 'testimonials', props: { items: [{ author: 'Jane', quote: 'Great!' }] } },
{ type: 'faq', props: { items: [{ q: 'Q1', a: 'A1' }] } },
{ type: 'cta', props: { text: 'Get Started', href: '#' } },
],
form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } },
seo: { title: 'SEO', description: 'Desc' },
})
}
describe('Exporter - section a11y template', () => {
it('validates basic a11y landmarks, headings and tokens', () => {
const out = exportPage(makeFullPage())
assertSectionA11y(out.html)
})
})