테스트/린트 안정화: 버튼 쿼리 모호성 제거, 훅 deps 보강, vi.spyOn 모킹, 멀티선택 Moveable 간섭 방지 재확인, 스냅 우선순위 회귀 그린
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { render, screen, fireEvent } from '@testing-library/react'
|
||||
import { WysiwygBuilderPage } from '@/components/wysiwyg/WysiwygBuilderPage'
|
||||
|
||||
describe('WYSIWYG Builder - Form Help (aria-describedby)', () => {
|
||||
it('Input: edits Help in Properties and Canvas reflects help + aria-describedby', async () => {
|
||||
render(<WysiwygBuilderPage />)
|
||||
|
||||
// Add Input
|
||||
fireEvent.click(screen.getByRole('button', { name: /Add Input/i }))
|
||||
|
||||
const obj = await screen.findByTestId(/obj-input-/)
|
||||
fireEvent.mouseDown(obj, { clientX: 80, clientY: 80 })
|
||||
fireEvent.mouseUp(screen.getByTestId('wysiwyg-canvas'))
|
||||
|
||||
const panel = await screen.findByLabelText('Properties Panel')
|
||||
const helpInput = panel.querySelector('input[aria-label="Help"]') as HTMLInputElement
|
||||
fireEvent.change(helpInput, { target: { value: 'We will not spam you.' } })
|
||||
|
||||
const rendered = await screen.findByTestId(/obj-input-/)
|
||||
expect(rendered).toHaveTextContent('We will not spam you.')
|
||||
const inputEl = rendered.querySelector('input') as HTMLInputElement
|
||||
expect(inputEl).toBeTruthy()
|
||||
const describedby = inputEl.getAttribute('aria-describedby')
|
||||
expect(describedby).toMatch(/-help$/)
|
||||
const helpEl = rendered.querySelector(`#${describedby}`)
|
||||
expect(helpEl?.textContent).toContain('We will not spam you.')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user