fix(editor): keyboard refused-commit rule, missing history tests

Keyboard activation after a refused blur commit skips the undo and refocuses the field. Adds restore, Général-from-Annotations and DeleteDialog tests; SaveLine helpers.
This commit is contained in:
bchanot committed 2026-11-08 18:09:10 +01:00
1 parent 99b669bf8f
commit 89da8d3f55
4 files changed
+133 -35

No files matched your search

@@ -13,8 +13,12 @@ import {
import saveLineSource from '@/editor/saveLine.ts?raw'
import saveSource from '@/editor/state/editorSave.ts?raw'
import {
SHEET,
USER,
VERSION,
baseText,
commitMove,
copyKeyOf,
openReady,
resetStore,
sb,
@@ -97,6 +101,21 @@ describe('savedDistance', () => {
expect(distance()).toBeNull()
})
it('is null after a restored recovery copy', async () => {
const copy = JSON.parse(baseText(), (key, value) => (key === 'cx' ? 10 : value))
sessionStorage.setItem(
copyKeyOf(),
JSON.stringify({
v: 1, user_id: USER, version_id: VERSION, sheet_id: SHEET, sheet_name: 'Fiche',
revision: 3, written_at: '2026-11-03T10:00:00Z', document: copy, drawings: [],
}),
)
await openReady({ revision: 3 })
expect(await store.getState().restoreCopy()).toEqual({ ok: true })
expect(store.getState().unsaved).toBe(true)
expect(distance()).toBeNull()
})
it('is null for a stale base', async () => {
await openReady({ revision: 3 })
commitMove(40)