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,33 @@
|
||||
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: 'Escape Regression',
|
||||
locale: 'en',
|
||||
theme: { primaryColor: '#0ea5e9', fontFamily: 'Inter' },
|
||||
sections: [
|
||||
{ type: 'features', props: { items: ['F<&>"', 'Safe'] } },
|
||||
{ type: 'faq', props: { items: [{ q: 'Q<&>"', a: 'A<&>"' }] } },
|
||||
],
|
||||
form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } },
|
||||
seo: { title: 'SEO', description: 'Desc' },
|
||||
})
|
||||
}
|
||||
|
||||
describe('Exporter - HTML escape regression (Features/FAQ)', () => {
|
||||
it('escapes HTML special characters in features items', () => {
|
||||
const out = exportPage(makePage())
|
||||
const html = out.html
|
||||
// feature item should contain escaped characters < & > "
|
||||
expect(html).toContain('<li class="feature-item">F<&>"</li>')
|
||||
})
|
||||
|
||||
it('escapes HTML special characters in faq q/a', () => {
|
||||
const out = exportPage(makePage())
|
||||
const html = out.html
|
||||
expect(html).toContain('<h3 class="faq-q">Q<&>"</h3>')
|
||||
expect(html).toContain('<p class="faq-a">A<&>"</p>')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user