test(tests): origin kept on a re-placed keyboard point

This commit is contained in:
bchanot committed 2026-11-20 16:34:59 +01:00
1 parent 17c35638e8
commit 007d9d419e
1 file changed
+40
@@ -237,6 +237,37 @@ describe('the keyboard keeps the centre path (C7)', () => {
}) })
}) })
describe('a keyboard point re-placed by pointer', () => {
it('keeps its keyboard origin: abandoning focuses « Ajouter un point »', async () => {
const user = await mount()
await addByKeyboard(user, add('un point'))
const shown = await dialog('Nouveau point')
await user.click(
within(shown).getByRole('button', { name: 'Replacer le point' }),
)
await waitFor(noDialog)
pressAt(canvas(), 60, 60)
await dialog('Nouveau point')
expect(ghost()).toHaveAttribute('cx', '60')
await user.click(
within(screen.getByTestId('annotation-creation')).getByRole('button', {
name: 'Replacer le point',
}),
)
await waitFor(noDialog)
await user.click(
within(screen.getByTestId('edit-strip')).getByRole('button', {
name: 'Abandonner',
}),
)
const ask = await screen.findByRole('dialog', {
name: 'Abandonner la création ?',
})
await user.click(within(ask).getByRole('button', { name: 'Abandonner' }))
await waitFor(() => expect(add('un point')).toHaveFocus())
})
})
describe('the screen-reader path', () => { describe('the screen-reader path', () => {
it('announces the armed tool, then Enter in the drawing places at the centre', async () => { it('announces the armed tool, then Enter in the drawing places at the centre', async () => {
const user = await mount() const user = await mount()
@@ -271,6 +302,15 @@ describe('the screen-reader path', () => {
noDialog() noDialog()
expect(useAnnotationWork.getState().creation).toBeNull() expect(useAnnotationWork.getState().creation).toBeNull()
}) })
it('with a tool armed, Shift+Enter on the drawing creates nothing', async () => {
const user = await mount()
await user.click(add('un point'))
canvas().focus()
await user.keyboard('{Shift>}{Enter}{/Shift}')
noDialog()
expect(useAnnotationWork.getState().creation).toBeNull()
})
}) })
describe('a redraw lends the zone tool', () => { describe('a redraw lends the zone tool', () => {