test(ci): add exporter heading levels and a11y typography smoke; update MAIN_PLAN
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { exportPage } from './html'
|
||||
import { pageSchema, type Page } from '@/lib/schema/page'
|
||||
|
||||
function makeBase(overrides: Partial<Page>): Page {
|
||||
const base: Page = {
|
||||
title: 'T',
|
||||
locale: 'en',
|
||||
theme: { primaryColor: '#000000', fontFamily: 'Inter' },
|
||||
sections: [],
|
||||
form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } },
|
||||
analytics: { ga4MeasurementId: '', metaPixelId: '', customHeadHtml: '' },
|
||||
seo: { title: 'SEO', description: 'Desc' },
|
||||
}
|
||||
return pageSchema.parse({ ...base, ...overrides })
|
||||
}
|
||||
|
||||
describe('Exporter - Features and Testimonials sections', () => {
|
||||
test('renders features list with items and classes', () => {
|
||||
const sections = ([
|
||||
{ type: 'features', props: { items: ['One', 'Two', 'Three'] } },
|
||||
] as unknown) as Page['sections']
|
||||
const page = makeBase({ sections })
|
||||
const out = exportPage(page)
|
||||
expect(out.html).toContain('<section class="features" aria-labelledby="features-heading">')
|
||||
expect(out.html).toContain('<ul class="features-list">')
|
||||
expect(out.html).toContain('<li class="feature-item">One</li>')
|
||||
expect(out.html).toContain('<li class="feature-item">Two</li>')
|
||||
expect(out.html).toContain('<li class="feature-item">Three</li>')
|
||||
})
|
||||
|
||||
test('renders testimonials with figure/blockquote/figcaption structure', () => {
|
||||
const sections = ([
|
||||
{ type: 'testimonials', props: { items: [
|
||||
{ author: 'Jane', quote: 'Great!' },
|
||||
{ author: 'John', quote: 'Nice.' },
|
||||
] } },
|
||||
] as unknown) as Page['sections']
|
||||
const page = makeBase({ sections })
|
||||
const out = exportPage(page)
|
||||
expect(out.html).toContain('<section class="testimonials" aria-labelledby="testimonials-heading">')
|
||||
expect(out.html).toContain('<figure class="testimonial">')
|
||||
expect(out.html).toContain('<blockquote>“Great!”</blockquote>')
|
||||
expect(out.html).toContain('<figcaption>— Jane</figcaption>')
|
||||
expect(out.html).toContain('<blockquote>“Nice.”</blockquote>')
|
||||
expect(out.html).toContain('<figcaption>— John</figcaption>')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user