fix(editor): « − » press follows Delete, discriminating focus tests

This commit is contained in:
bchanot committed 2026-11-19 12:00:48 +01:00
1 parent 03e85a7c67
commit 62b400e876
9 files changed
+131 -45

No files matched your search

@@ -178,6 +178,25 @@ describe('opening (A1)', () => {
expect(await screen.findByRole('dialog')).toBeVisible()
})
it('a tap on the point handle with a size change pending: the dialog takes the focus, the row gets it back', async () => {
await mount(
insert(insert(drawnText(), point('a', 50, 50, 5)), point('b', 20, 20, 8)),
)
await selectRow('a')
const slider = within(screen.getByTestId('size-slider')).getByRole('slider')
act(() => slider.focus())
fireEvent.keyDown(slider, { key: 'PageUp' })
const handle = screen.getByRole('button', { name: 'Point N' })
pressAt(handle.querySelector('[data-handle]')!, 50, 50)
const opened = await screen.findByRole('dialog')
expect(opened.contains(document.activeElement)).toBe(true)
await userEvent
.setup()
.click(within(opened).getByRole('button', { name: 'Fermer' }))
await waitFor(() => expect(dialog()).toBeNull())
expect(document.activeElement).toBe(rowOf('a'))
})
it('closed, the focus goes to the drawing when a filter hides the row (board 32)', async () => {
await mount(insert(drawnText(), point('a', 50, 50, 5)))
await selectRow('a')