test: expand exporter/css/a11y/i18n regressions and add e2e skip-link focus check

This commit is contained in:
2025-11-14 20:10:50 +09:00
parent d6510e2b05
commit 602f1eabde
26 changed files with 979 additions and 13 deletions
@@ -0,0 +1,41 @@
import { describe, it, expect } from 'vitest'
import { exportPage } from '@/lib/exporter/html'
import { pageSchema, type Page } from '@/lib/schema/page'
function makePage(): Page {
return pageSchema.parse({
title: 'Sections Regression Features/FAQ',
locale: 'en',
theme: { primaryColor: '#0ea5e9', fontFamily: 'Inter' },
sections: [
{ type: 'features', props: { items: ['F1', 'F2', 'F3'] } },
{ type: 'faq', props: { items: [{ q: 'Q1', a: 'A1' }, { q: 'Q2', a: 'A2' }] } },
],
form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } },
seo: { title: 'SEO', description: 'Desc' },
})
}
describe('Exporter - Features/FAQ regression (structure/classes/count)', () => {
it('renders features with list, class names, and correct item count', () => {
const out = exportPage(makePage())
const html = out.html
expect(html).toMatch(/<section class="features" aria-labelledby="features-heading">/)
expect(html).toMatch(/<h2 id="features-heading">Features<\/h2>/)
expect(html).toMatch(/<ul class="features-list">/)
const featureItems = html.match(/<li class="feature-item">/g) || []
expect(featureItems.length).toBe(3)
})
it('renders faq with list, h3 question class, and correct item count', () => {
const out = exportPage(makePage())
const html = out.html
expect(html).toMatch(/<section class="faq" aria-labelledby="faq-heading">/)
expect(html).toMatch(/<h2 id="faq-heading">FAQ<\/h2>/)
expect(html).toMatch(/<ul class="faq-list">/)
const qCount = html.match(/<h3 class="faq-q">/g) || []
const aCount = html.match(/<p class="faq-a">/g) || []
expect(qCount.length).toBe(2)
expect(aCount.length).toBe(2)
})
})