fix(editor): slider while replacing, announced drop, review minors

Task 7 fix round 1 (review task-7-review.md).
- Important 1: « Taille » shows beside « Revenir aux propriétés » while
  a point is replaced (still hidden under the modal dialog); it feeds
  the hover preview and the re-placed point (R-10).
- Important 2: a creation whose view leaves the document is dropped
  and said, « Création abandonnée : la fiche a changé. » (dropped:
  'creation', read by useDroppedNotice).
- Minor 3: DrawingGuardDialog leaves a creation question to the
  creation dialog only while that dialog is really on screen
  (creationShown, set by the dialog).
- Minor 7: the dialog's long className strings split into constants.
- Minor 8: dead TOOL_OF removed; trace_start is a redraw's only.

Tests added (no assertion removed): slider while replacing (unit,
RED then GREEN; e2e under expectNoShift at three widths, last strip
command inside the strip); view removed during a creation (RED then
GREEN); question shown by the workspace when the dialog is not on
screen (RED then GREEN); « Abandonner » while read-only; R-13 with a
restored copy during a started move; leaving the route resets the
work (fails with the session reset removed). The unit Back test's
comment is corrected: it does pin the modal branch.
This commit is contained in:
bchanot committed 2026-11-18 00:06:16 +01:00
1 parent fe333c2bbd
commit 837ec9f436
14 files changed
+315 -29

No files matched your search

@@ -18,6 +18,8 @@ import { FocusConsumedContext } from '@/editor/focusRequest'
import { targetOfKey } from '@/editor/navigation'
import { useLocaleStore } from '@/state/localeStore'
import { useAnnotationWork } from '@/editor/annotations/workStore'
import { emptyForm } from '@/editor/annotations/creation'
import { traceVertex } from '@/editor/annotations/creationWork'
import { cleanSvg } from '@/editor/core/cleaning'
import {
ASSET,
@@ -575,3 +577,40 @@ describe('a tab while a creation or a tracing is in progress', () => {
expect(within(back).getByLabelText('Nom (FR)')).toHaveValue('Nuque')
})
})
/**
* Fix round 1 (review ⚠️): a shell link with nothing at stake is not intercepted, so the
* route's own cleanup must end the drawing's work. The route closes the store session on
* unmount (`AdminSheetDraftRoute`), and a session change resets the work store.
*/
describe('leaving the editor route resets the drawing work', () => {
// A mode on no selection is ended by the body itself (`useModeFollowsSelection`), so the
// work held here is a creation; the reset is the same `resetWork` for a mode.
it('a creation is gone once the route unmounts, its question too', async () => {
serverHas(baseText(), 3)
const view = mountDraft()
await ready()
const base = store.getState().documentText
const viewId = JSON.parse(base).views[0].id as string
act(() => {
traceVertex(
{
viewId,
frame: null,
origin: 'tool',
form: emptyForm({ categories: [] } as never),
},
'zone',
[1, 1],
)
})
expect(useAnnotationWork.getState().creation).not.toBeNull()
view.unmount()
expect(useAnnotationWork.getState()).toMatchObject({
mode: null,
preview: null,
creation: null,
question: null,
})
})
})