fix(editor): creation question lapses, guard sites and flip tested
The creation's « Abandonner la création ? » no longer outlives it: « Replacer le point », « Reprendre le tracé », « Créer » (« Utiliser cette position » included) and « Annuler le tracé » clear a question still open, which would otherwise reappear over the page. Locals trimmed in the creation dialog and the tracing actions (5 max). Tests added (no assertion removed): the two lapses (RED without the fix, GREEN with it); a view chip and a tool ask during a tracing; the mode flip keeps the dialog, its form and the ghost; a history jump out of the editor waits for the creation's question; e2e: « Reprendre le tracé » and « Revenir aux propriétés » under expectNoShift at 1 024, 1 180 and 1 280 px, the strip's last command inside it, axe on the resumed state.
This commit is contained in:
1 parent
4d2c64f57f
commit
fe333c2bbd
6 files changed
+219
-37
No files matched your search
@@ -14,6 +14,8 @@ import {
|
||||
} from '@/editor/useEditorNavigation'
|
||||
import { useLocaleStore } from '@/state/localeStore'
|
||||
import { answerDrawing } from '@/editor/annotations/drawingGuard'
|
||||
import { emptyForm } from '@/editor/annotations/creation'
|
||||
import { traceVertex } from '@/editor/annotations/creationWork'
|
||||
import {
|
||||
resetWork,
|
||||
setModePreview,
|
||||
@@ -160,6 +162,31 @@ describe('the drawing guard on a history jump out of the editor (R-12)', () => {
|
||||
expect(api.traverseTo).toHaveBeenCalledWith('list')
|
||||
})
|
||||
|
||||
it('during a creation (A12): the jump waits for « Abandonner la création ? », then goes', () => {
|
||||
cleanup()
|
||||
render(
|
||||
<MemoryRouter initialEntries={[path]}>
|
||||
<DrawingOnly />
|
||||
</MemoryRouter>,
|
||||
)
|
||||
traceVertex(
|
||||
{
|
||||
viewId: 'v',
|
||||
frame: null,
|
||||
origin: 'tool',
|
||||
form: emptyForm({ categories: [] } as never),
|
||||
},
|
||||
'zone',
|
||||
[1, 1],
|
||||
)
|
||||
expect(jump().defaultPrevented).toBe(true)
|
||||
expect(useAnnotationWork.getState().question?.work).toBe('creation')
|
||||
expect(api.traverseTo).not.toHaveBeenCalled()
|
||||
act(() => answerDrawing(true))
|
||||
expect(useAnnotationWork.getState().creation).toBeNull()
|
||||
expect(api.traverseTo).toHaveBeenCalledWith('list')
|
||||
})
|
||||
|
||||
it('with nothing started: the jump is not held and the mode ends', () => {
|
||||
cleanup()
|
||||
render(
|
||||
|
||||
Reference in new issue
Block a user