Export A11y 회귀 매트릭스: input/select/textarea label/for·describedby, radio/checkbox fieldset·legend·help 검증 추가
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { exportFrame } from '@/lib/wysiwyg/export'
|
||||
import type { Frame } from '@/lib/wysiwyg/schema'
|
||||
|
||||
function baseFrame(): Frame {
|
||||
return {
|
||||
id: 'f', width: 400, height: 300, background: '#111111',
|
||||
layers: [{ id: 'l1', name: 'Base', visible: true, locked: false, objects: [] }],
|
||||
}
|
||||
}
|
||||
|
||||
describe('wysiwyg export - form tokens deep regression', () => {
|
||||
it('contains ring/disabled tokens and applies across selectors', () => {
|
||||
const out = exportFrame(baseFrame())
|
||||
const css = out.css
|
||||
// tokens
|
||||
expect(css).toMatch(/:root[^}]*--ring:/)
|
||||
expect(css).toMatch(/:root[^}]*--ring-offset:/)
|
||||
expect(css).toMatch(/:root[^}]*--disabled-bg:/)
|
||||
expect(css).toMatch(/:root[^}]*--disabled-fg:/)
|
||||
// usages
|
||||
expect(css).toMatch(/:focus-visible\s*{[^}]*outline:2px solid var\(--ring\)/)
|
||||
expect(css).toMatch(/:focus-visible\s*{[^}]*outline-offset:var\(--ring-offset\)/)
|
||||
expect(css).toMatch(/input:disabled,select:disabled,textarea:disabled\s*{[^}]*background:var\(--disabled-bg\)/)
|
||||
expect(css).toMatch(/input\[readonly\],select\[readonly\],textarea\[readonly\]\s*{[^}]*color:var\(--disabled-fg\)/)
|
||||
})
|
||||
|
||||
it('themes define overrides without breaking base var() usage', () => {
|
||||
const out = exportFrame(baseFrame())
|
||||
const css = out.css
|
||||
expect(css).toMatch(/\[data-theme="light"\][^{]*{[^}]*--bg:/)
|
||||
expect(css).toMatch(/\[data-theme="dark"\][^{]*{[^}]*--bg:/)
|
||||
expect(css).toMatch(/\.frame\s*{[^}]*background:var\(--bg\)/)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user