feat(editor): header history, save line and Abandonner les modifications

Header Annuler/Retablir on every tab (aria-disabled, commit on pointerdown,
refused blur commit skips the undo). Save line: unsaved count selector
(savedDistance), saveLineState forms, server save time via readSaveTime
(lastSave in the store, never the browser clock). Discard relabelled and
names the stored copy. Tool column pair removed, glyphs in EditorGlyph.

Rewritten or removed assertions (R-24):
- editor-route.test: Revision 3 / unsaved text / Annuler les modifications
  -> save-line testid, Abandonner label, copy sentence in the dialog
- editor-route-conflict, editor-route-recovery: Revision n and copy_cap/
  copy_quota text queries -> save-line testid
- editor-no-loss: discard button label
- editor-annotations-tab: tool column undo/redo test -> no pair left
  (behaviour moved to editor-history-buttons.test)
- e2e journey/annotations/recovery/structures/support saveDraft/lan:
  undo/redo and revision/unsaved text -> historyButton, saveLine helpers;
  structures toHaveCount(0) on old text -> exact Revision n line
- editor-shell clickability: header Annuler/Retablir added
This commit is contained in:
bchanot committed 2026-11-08 17:55:49 +01:00
1 parent ab51ea764d
commit 99b669bf8f
29 files changed
+1397 -248

No files matched your search

+7 -13
View File
@@ -4,7 +4,7 @@ import { rpc } from '../../../../packages/supabase/tests/sandbox/stack'
import { expect, expectAccessible, test } from '../support/browser'
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
import {
place,
type Actor,
copyKeyOf,
editorActor,
expiringEditor,
@@ -12,15 +12,18 @@ import {
openDraft,
openEditor,
ownerActor,
place,
reloadAccepting,
savedLine,
saveDraft,
saveLine,
seedDraft,
selectTab,
serverDocument,
serverRevision,
standardShape,
storedCopy,
type Actor,
UNSAVED_LINE,
} from '../support/editor'
import { stepUpAdmin } from '../support/admin'
import { secondSession } from '../support/editor'
@@ -143,9 +146,7 @@ test.describe('editor recovery and concurrency', () => {
const seed = await seedDraft(actor, { shape: standardShape })
await openGeneral(page, actor, seed.sheetId)
await commitText(nameFr(page), 'Mon travail local')
await expect(
page.getByText(dict['editor.draft.status.unsaved'], { exact: false }),
).toBeVisible()
await expect(saveLine(page)).toHaveText(UNSAVED_LINE)
await advanceServer(actor, seed.draftId, 1)
expect(await reloadAccepting(page)).toContain('beforeunload')
@@ -168,14 +169,7 @@ test.describe('editor recovery and concurrency', () => {
await expect(conflict).toContainText('Remplacer la révision 2')
await button(conflict, dict['editor.draft.conflict.keep']).click()
await expect(conflict).toBeHidden()
await expect(
page.getByText(
dict['editor.draft.status.revision'].replace('{revision}', '3'),
{
exact: true,
},
),
).toBeVisible()
await expect(saveLine(page)).toHaveText(savedLine(dict, 3))
const saved = await serverDocument<{ name: { fr: string } }>(seed.draftId)
expect(saved.name.fr).toBe('Mon travail local')
})