WYSIWYG: a11y 라이브 리전 안내 추가\n- 선택 개수/좌표 및 가이드 좌표 안내(useMemo 기반)\n- a11y 테스트 추가(guides/nudge)\n- 메인플랜 업데이트\n- 전체 테스트 그린
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { render, fireEvent, waitFor } from '@testing-library/react'
|
||||
import { Canvas } from '@/components/wysiwyg/Canvas'
|
||||
import type { Frame } from '@/lib/wysiwyg/schema'
|
||||
|
||||
function makeFrame(): Frame {
|
||||
return {
|
||||
id: 'f1',
|
||||
width: 200,
|
||||
height: 160,
|
||||
background: '#ffffff',
|
||||
layers: [
|
||||
{
|
||||
id: 'l1',
|
||||
name: 'L1',
|
||||
visible: true,
|
||||
locked: false,
|
||||
objects: [
|
||||
{ id: 'o1', type: 'image', x: 10, y: 12, width: 32, height: 24, rotate: 0, zIndex: 0, props: { src: 'a', alt: '' } },
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
describe('WYSIWYG Canvas a11y live region for keyboard nudge', () => {
|
||||
it('announces selected object coordinates after Arrow key nudge', async () => {
|
||||
const frame = makeFrame()
|
||||
const { getByTestId } = render(<Canvas frame={frame} />)
|
||||
|
||||
const canvas = getByTestId('wysiwyg-canvas')
|
||||
const live = getByTestId('aria-live')
|
||||
|
||||
// Focus and nudge to the right by 1 (snap8 applies → from 10 to 8 or 16 depending on rounding)
|
||||
canvas.focus()
|
||||
fireEvent.keyDown(canvas, { key: 'ArrowRight' })
|
||||
|
||||
await waitFor(() => {
|
||||
const t = live.textContent || ''
|
||||
expect(t).toMatch(/선택\s*1개/)
|
||||
expect(t).toMatch(/위치\s*x=\d+/)
|
||||
expect(t).toMatch(/y=\d+/)
|
||||
})
|
||||
|
||||
// Nudge down
|
||||
fireEvent.keyDown(canvas, { key: 'ArrowDown' })
|
||||
await waitFor(() => {
|
||||
const t = live.textContent || ''
|
||||
expect(t).toMatch(/위치\s*x=\d+,\s*y=\d+/)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user