test: expand exporter/css/a11y/i18n regressions and add e2e skip-link focus check
CI / test (pull_request) Successful in 52s
CI / test (pull_request) Successful in 52s
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
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 CTA/Testimonials',
|
||||
locale: 'en',
|
||||
theme: { primaryColor: '#0ea5e9', fontFamily: 'Inter' },
|
||||
sections: [
|
||||
{ type: 'testimonials', props: { items: [{ author: 'Linus', quote: 'Simple and fast' }] } },
|
||||
{ type: 'cta', props: { text: 'Get Started', href: '/start' } },
|
||||
],
|
||||
form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } },
|
||||
seo: { title: 'SEO', description: 'Desc' },
|
||||
})
|
||||
}
|
||||
|
||||
describe('Exporter - CTA and Testimonials regression', () => {
|
||||
it('renders testimonials figure/blockquote/figcaption structure', () => {
|
||||
const out = exportPage(makePage())
|
||||
const html = out.html
|
||||
expect(html).toMatch(/<section class="testimonials" aria-labelledby="testimonials-heading">/)
|
||||
expect(html).toMatch(/<h2 id="testimonials-heading">Testimonials<\/h2>/)
|
||||
expect(html).toMatch(/<figure class="testimonial">[\s\S]*<blockquote>“Simple and fast”<\/blockquote>[\s\S]*<figcaption>— Linus<\/figcaption>[\s\S]*<\/figure>/)
|
||||
})
|
||||
|
||||
it('renders CTA link with correct class and href', () => {
|
||||
const out = exportPage(makePage())
|
||||
const html = out.html
|
||||
expect(html).toMatch(/<section class="cta" aria-labelledby="cta-heading">/)
|
||||
expect(html).toMatch(/<h2 id="cta-heading">CTA<\/h2>/)
|
||||
expect(html).toMatch(/<a class="btn-cta" href="\/start">Get Started<\/a>/)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user