fix(editor): final review fixes (touch undo guard, focus, save line)
Important 1: a touch press fires pointer leave between up and click; only a mouse leave (or a pointer cancel) forgets the refused field, so Annuler no longer undoes an unrelated change. Important 2: the LAN spec reads the revision before the attach, through shownRevision, which throws instead of NaN (spec stays not run). Minor 1: refocusIfHidden refocuses a still shown element the commit blurred (references search on a 1 024 px crossing). Minor 2: discardChanges keeps lastSave (reload path still drops it). Minor 3: the overview filter term lives in UiState / the read-only twin, not the card. Minor 4: categories section drops its inner h3 and the unused editor.general.categories keys. AC8: badge test. Assertions rewritten or added (R-24): - editor-tabs-general « Général no longer holds the categories editor »: queryByText of the deleted heading (now vacuous) -> queryByLabelText of the category name fields. - editor-focus-request « Annotations: selects the annotation »: findAllByText /anno-b|Sélection/ -> the properties panel holds Centre x = 20 (anno-b) and owns the focused heading. - editor-shell-layout panel walk: added after.at(-1) === 'side'. - editor-recovery title « Annuler les modifications » -> « Abandonner ». - new: touch/cancel/mouse press, references search crossing, discard keeps lastSave, filter kept, one categories heading, badge 1/2/0, shownRevision.
This commit is contained in:
1 parent
942d52a835
commit
0467885527
22 files changed
+327
-38
No files matched your search
@@ -3,6 +3,7 @@ import { fr } from '@/i18n/fr'
|
||||
import type { Page } from '@playwright/test'
|
||||
import { totpCode } from '../../../../packages/supabase/tests/sandbox/totp'
|
||||
import { expect, test } from '../support/browser'
|
||||
import { shownRevision } from '../support/saveLineText'
|
||||
|
||||
// Owner trial through its LAN origin (C47): sign-in, TOTP enrolment and challenge, the
|
||||
// catalogue, a non-equine sheet, an SVG import, save and reload. The request guard of
|
||||
@@ -23,11 +24,9 @@ const SVG =
|
||||
|
||||
const saveLine = (page: Page) => page.getByTestId('save-line')
|
||||
|
||||
// Read while the line says « Révision n »: a pending change shows no revision.
|
||||
async function revisionShown(page: Page): Promise<number> {
|
||||
const text = (await saveLine(page).textContent()) ?? ''
|
||||
return Number(
|
||||
/révision (\d+)|Révision (\d+)/.exec(text)?.slice(1).find(Boolean),
|
||||
)
|
||||
return shownRevision((await saveLine(page).textContent()) ?? '')
|
||||
}
|
||||
|
||||
async function nextCode(secret: string): Promise<string> {
|
||||
@@ -131,6 +130,8 @@ test('trial through the LAN origin: MFA, new sheet, SVG import, save, reload', a
|
||||
await challenge(page, secret)
|
||||
await createNonEquineSheet(page, tag)
|
||||
await openViews(page)
|
||||
await expect(saveLine(page)).toHaveText(/^Révision \d+$/)
|
||||
const before = await revisionShown(page)
|
||||
await page
|
||||
.locator('[data-testid$="-file"]')
|
||||
.first()
|
||||
@@ -147,7 +148,6 @@ test('trial through the LAN origin: MFA, new sheet, SVG import, save, reload', a
|
||||
.getByRole('button', { name: dict['editor.cleaning.confirm'] })
|
||||
.click()
|
||||
await expect(page.getByText(dict['editor.upload.done'])).toBeVisible()
|
||||
const before = await revisionShown(page)
|
||||
await page.getByRole('button', { name: dict['common.save'] }).click()
|
||||
await expect(saveLine(page)).toHaveText(
|
||||
new RegExp(`^Enregistré( à \\d\\d:\\d\\d)? · révision ${before + 1}$`),
|
||||
|
||||
@@ -308,5 +308,6 @@ test.describe('editor shell keyboard order (H)', () => {
|
||||
const after = await walk(page, 'side')
|
||||
expect(after.slice(0, 4)).toEqual(['header', 'tab', 'undo', 'redo'])
|
||||
expect(after).not.toContain('panel')
|
||||
expect(after.at(-1)).toBe('side')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* The revision a save line text names: « Révision n » or « Enregistré · révision n ». The
|
||||
* unsaved forms name none, so a reading taken while changes are pending throws instead of
|
||||
* answering NaN.
|
||||
*/
|
||||
export function shownRevision(text: string): number {
|
||||
const found = /révision (\d+)/i.exec(text)
|
||||
if (!found) throw new Error(`The save line shows no revision: « ${text} »`)
|
||||
return Number(found[1])
|
||||
}
|
||||
Reference in new issue
Block a user