fix(editor): commit a keyed series before a move or a redraw starts
Safari, and iPad Safari on a tap, focuses no clicked button: the
handle or the slider keeps the focus, no blur commits its series, and
« Déplacer … », « Redessiner » or « Remplacer par un polygone »
cleared it (preview: null) without a word. startMove and beginRedraw
now call commitFocusedSeries() first, the same path a drawing press
takes since 10a8767. « Propriétés » (guardDrawing) and
« Désélectionner » (useDeselect) already committed; a test pins both.
Tests: no assertion removed.
This commit is contained in:
1 parent
a5af9bdd4f
commit
a75c2999de
4 files changed
+86
No files matched your search
@@ -719,3 +719,32 @@ describe('fix round 1: no silent loss on the way out', () => {
|
||||
expect(screen.getByTestId('move-mode-bar')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
describe('Safari: « Déplacer le point » clicked with the focus left on the slider', () => {
|
||||
it('commits the size change, then starts the mode', async () => {
|
||||
await mount(withPoints(point('a', 50, 50, 5), point('b', 20, 20, 8)))
|
||||
await select()
|
||||
act(() => slider().focus())
|
||||
fireEvent.keyDown(slider(), { key: 'PageUp' })
|
||||
const before = depth()
|
||||
fireEvent.click(moveButton())
|
||||
expect(geometryOf('a')).toMatchObject({ r: 8 })
|
||||
expect(depth()).toBe(before + 1)
|
||||
expect(useAnnotationWork.getState().mode).toMatchObject({
|
||||
kind: 'move',
|
||||
base: store.getState().documentText,
|
||||
})
|
||||
})
|
||||
|
||||
it('commits an arrow series on the point handle the same way', async () => {
|
||||
await mount(withPoints(point('a', 50, 50, 5)))
|
||||
await select()
|
||||
act(() => handle().focus())
|
||||
fireEvent.keyDown(handle(), { key: 'ArrowRight' })
|
||||
const before = depth()
|
||||
fireEvent.click(moveButton())
|
||||
expect(geometryOf('a')).not.toMatchObject({ cx: 50 })
|
||||
expect(depth()).toBe(before + 1)
|
||||
expect(useAnnotationWork.getState().mode?.kind).toBe('move')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user