fix(editor): a press on a held redo keeps the pending work untouched
This commit is contained in:
1 parent
00e995a6cb
commit
8f036b2a8a
3 files changed
+76
No files matched your search
@@ -638,6 +638,41 @@ describe('why a button is held (point 6)', () => {
|
||||
expect(line()).toHaveTextContent(PENDING)
|
||||
})
|
||||
|
||||
it('a mouse press on a held « Refaire » leaves the focused pending work alone', async () => {
|
||||
const user = await openAnnotations()
|
||||
pend()
|
||||
// A handle's blur commits its series (here: ends the preview), as the real one does.
|
||||
const handle = document.createElement('button')
|
||||
handle.addEventListener('blur', () =>
|
||||
useAnnotationWork.setState({ preview: null }),
|
||||
)
|
||||
document.body.append(handle)
|
||||
handle.focus()
|
||||
store.setState({ redo: [{ text: baseText(), bytes: 1 }] })
|
||||
await user.pointer([
|
||||
{ keys: '[MouseLeft>]', target: redoButton() },
|
||||
{ keys: '[/MouseLeft]' },
|
||||
])
|
||||
expect(handle).toHaveFocus()
|
||||
expect(useAnnotationWork.getState().preview).not.toBeNull()
|
||||
expect(store.getState().redo).toHaveLength(1)
|
||||
expect(line()).toHaveTextContent(PENDING)
|
||||
handle.remove()
|
||||
})
|
||||
|
||||
it('Space on a held « Défaire » and Enter on a pending « Refaire » say why', async () => {
|
||||
const user = await openAnnotations()
|
||||
create()
|
||||
undoButton().focus()
|
||||
await user.keyboard(' ')
|
||||
expect(line()).toHaveTextContent(CREATION)
|
||||
act(() => resetWork())
|
||||
pend()
|
||||
redoButton().focus()
|
||||
await user.keyboard('{Enter}')
|
||||
expect(line()).toHaveTextContent(PENDING)
|
||||
})
|
||||
|
||||
it('say it in English', async () => {
|
||||
const user = await openAnnotations()
|
||||
act(() => useLocaleStore.setState({ locale: 'en' }))
|
||||
|
||||
Reference in new issue
Block a user