From 28f9548f16f67ea9e193d30e34e932b84208bfe5 Mon Sep 17 00:00:00 2001 From: Jaybe Date: Mon, 17 Nov 2025 19:45:31 +0900 Subject: [PATCH] =?UTF-8?q?Export=20A11y=20=ED=9A=8C=EA=B7=80=20=EB=A7=A4?= =?UTF-8?q?=ED=8A=B8=EB=A6=AD=EC=8A=A4:=20input/select/textarea=20label/fo?= =?UTF-8?q?r=C2=B7describedby,=20radio/checkbox=20fieldset=C2=B7legend?= =?UTF-8?q?=C2=B7help=20=EA=B2=80=EC=A6=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/wysiwyg/export.form.a11y.matrix.test.ts | 65 +++++++++++++++++++ .../export.style.tokens.form.deep.test.ts | 35 ++++++++++ 2 files changed, 100 insertions(+) create mode 100644 lib/wysiwyg/export.form.a11y.matrix.test.ts create mode 100644 lib/wysiwyg/export.style.tokens.form.deep.test.ts diff --git a/lib/wysiwyg/export.form.a11y.matrix.test.ts b/lib/wysiwyg/export.form.a11y.matrix.test.ts new file mode 100644 index 0000000..54a2a72 --- /dev/null +++ b/lib/wysiwyg/export.form.a11y.matrix.test.ts @@ -0,0 +1,65 @@ +import { describe, it, expect } from 'vitest' +import { exportFrame } from '@/lib/wysiwyg/export' +import type { Frame } from '@/lib/wysiwyg/schema' + +function frameWithForm(): Frame { + return { + id: 'f', width: 600, height: 400, background: '#ffffff', + layers: [ + { + id: 'base', name: 'Base', visible: true, locked: false, objects: [ + { id: 't1', type: 'input', x: 40, y: 40, width: 200, height: 32, rotate: 0, zIndex: 0, props: { name: 'email', label: 'Email', placeholder: '', required: true, help: 'We never share your email.' } }, + { id: 't2', type: 'select', x: 40, y: 100, width: 200, height: 32, rotate: 0, zIndex: 0, props: { name: 'country', label: 'Country', options: ['KR','US'], defaultValue: 'KR', help: 'Pick one' } }, + { id: 't3', type: 'textarea', x: 40, y: 160, width: 280, height: 80, rotate: 0, zIndex: 0, props: { name: 'msg', label: 'Message', placeholder: '', rows: 3, required: false, help: 'Optional' } }, + { id: 't4', type: 'radio', x: 320, y: 40, width: 200, height: 90, rotate: 0, zIndex: 0, props: { name: 'plan', legend: 'Plan', options: ['Basic','Pro'], defaultValue: 'Basic', required: false, help: 'Choose your plan' } }, + { id: 't5', type: 'checkbox', x: 320, y: 150, width: 200, height: 60, rotate: 0, zIndex: 0, props: { name: 'agree', legend: 'Agree to terms', options: ['Yes'], defaultValues: [], required: false, help: 'You must agree' } }, + ] + } + ], + } +} + +describe('wysiwyg export - a11y matrix for form controls', () => { + it('label/for + aria-describedby for input/select/textarea', () => { + const out = exportFrame(frameWithForm()) + const html = out.html + // input + expect(html).toMatch(/