29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { pageSchema, type Page } from '@/lib/schema/page'
|
|
import { exportPage } from '@/lib/exporter/html'
|
|
|
|
const makePage = (): Page =>
|
|
pageSchema.parse({
|
|
title: 'Benefits Test',
|
|
locale: 'en',
|
|
theme: { primaryColor: '#0ea5e9', fontFamily: 'Inter' },
|
|
sections: [
|
|
{ type: 'benefits', props: { items: ['Fast setup', 'No code', 'Accessible by default'] } },
|
|
],
|
|
form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } },
|
|
seo: { title: 'SEO', description: 'Desc' },
|
|
})
|
|
|
|
describe('Exporter - benefits section', () => {
|
|
it('renders benefits as a section with h2 and aria-labelledby + list items', () => {
|
|
const out = exportPage(makePage())
|
|
const html = out.html
|
|
expect(html).toContain('<section class="benefits" aria-labelledby="benefits-heading">')
|
|
expect(html).toContain('<h2 id="benefits-heading">Benefits</h2>')
|
|
expect(html).toContain('<ul class="benefits-list">')
|
|
expect(html).toContain('<li class="benefit-item">Fast setup</li>')
|
|
expect(html).toContain('<li class="benefit-item">No code</li>')
|
|
expect(html).toContain('<li class="benefit-item">Accessible by default</li>')
|
|
})
|
|
})
|