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

+19 -1
View File
@@ -1,5 +1,5 @@
import { fr } from '@/i18n/fr'
import type { Page, TestInfo } from '@playwright/test'
import type { Locator, Page, TestInfo } from '@playwright/test'
import { expect, test } from '../support/browser'
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
import {
@@ -17,6 +17,7 @@ import {
selectTab,
shapeWith,
showDrawing,
historyButton,
} from '../support/editor'
// V1-2.6 U1 B2a: tabs, Annotations sections and the references panel stay mounted. What
@@ -39,6 +40,17 @@ async function open(page: Page) {
return { ...seed, actor }
}
/** The button's centre hits the button itself: no panel or scrim covers it (any state). */
const hitsItself = (button: Locator) =>
button.evaluate((element) => {
const box = element.getBoundingClientRect()
const hit = document.elementFromPoint(
box.x + box.width / 2,
box.y + box.height / 2,
)
return hit !== null && element.contains(hit)
})
const active = (page: Page) => page.locator(':focus')
const layerTransform = (page: Page) =>
page
@@ -133,6 +145,12 @@ test.describe('editor shell, kept places (B2a)', () => {
for (const scrolled of [false, true]) {
await page.evaluate((y) => window.scrollTo(0, y), scrolled ? 400 : 0)
for (const target of targets) await target.click({ trial: true })
// « Annuler » / « Rétablir » may be aria-disabled (a trial click would wait).
for (const kind of ['undo', 'redo'] as const) {
const button = historyButton(page, dict, kind)
await button.scrollIntoViewIfNeeded()
expect(await hitsItself(button)).toBe(true)
}
const box = await panel.boundingBox()
for (const above of [header, tabs]) {
const other = await above.boundingBox()