29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import { describe, expect, test } from 'vitest'
|
|
import { exportPage } from './html'
|
|
import { pageSchema, type Page } from '@/lib/schema/page'
|
|
|
|
function makePage(): Page {
|
|
return pageSchema.parse({
|
|
title: 'T',
|
|
locale: 'en',
|
|
theme: { primaryColor: '#000000', fontFamily: 'Inter' },
|
|
sections: [
|
|
{ type: 'features', props: { items: ['One', 'Two'] } },
|
|
{ type: 'testimonials', props: { items: [{ author: 'Jane', quote: 'Great' }] } },
|
|
] as Page['sections'],
|
|
form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } },
|
|
analytics: { ga4MeasurementId: '', metaPixelId: '', customHeadHtml: '' },
|
|
seo: { title: 'SEO', description: 'Desc' },
|
|
})
|
|
}
|
|
|
|
describe('Exporter - Features/Testimonials aria-labelledby', () => {
|
|
test('has aria-labelledby and matching heading ids', () => {
|
|
const out = exportPage(makePage())
|
|
expect(out.html).toContain('<section class="features" aria-labelledby="features-heading">')
|
|
expect(out.html).toContain('<h2 id="features-heading">Features</h2>')
|
|
expect(out.html).toContain('<section class="testimonials" aria-labelledby="testimonials-heading">')
|
|
expect(out.html).toContain('<h2 id="testimonials-heading">Testimonials</h2>')
|
|
})
|
|
})
|