chore(editor): rev 4 review nits

This commit is contained in:
bchanot committed 2026-11-19 14:12:30 +01:00
1 parent 8f036b2a8a
commit 682bbd4a18
4 files changed
+10 -11

No files matched your search

@@ -268,9 +268,9 @@ test.describe('editor annotations (A3)', () => {
dict['editor.history.hold_pending'], dict['editor.history.hold_pending'],
) )
// Playwright refuses to click an aria-disabled button: scroll it clear of the sticky // Playwright refuses to click an aria-disabled button: scroll it clear of the sticky
// bar, then press it by force (the mouse events are real). // bar, then press it at its box (the mouse events are real).
await redo.evaluate((el) => el.scrollIntoView({ block: 'center' })) await redo.evaluate((el) => el.scrollIntoView({ block: 'center' }))
await redo.click({ force: true }) await pressAtBox(page, redo)
await expect(page.getByTestId('gesture-line')).toContainText( await expect(page.getByTestId('gesture-line')).toContainText(
dict['editor.history.hold_pending'], dict['editor.history.hold_pending'],
) )
@@ -55,9 +55,9 @@ function holdOf(
/** /**
* The press, in two steps: leaving a field commits the typed text (its blur: forced at * The press, in two steps: leaving a field commits the typed text (its blur: forced at
* pointer-down, natural when Tab reaches the button), the click or key then reads the * pointer-down unless the button is held, natural when Tab reaches the button), the click or
* store, so the typed text is the last change the undo reverts. A field whose commit was * key then reads the store, so the typed text is the last change the undo reverts. A field
* refused keeps its error: the step is skipped and focus goes back to it. The field is * whose commit was refused keeps its error: the step is skipped and focus goes back to it. The field is
* remembered across the pair: from a field, « Défaire » is two Shift+Tab away. A touch * remembered across the pair: from a field, « Défaire » is two Shift+Tab away. A touch
* press fires pointer leave between its up and its click, so only a mouse leaving the * press fires pointer leave between its up and its click, so only a mouse leaving the
* button forgets the field (a hovering pointer that left meant no press), or a cancel. * button forgets the field (a hovering pointer that left meant no press), or a cancel.
@@ -101,8 +101,8 @@ function stepVertex(input: ZoneEditInput, index: number, event: KeyboardEvent) {
const inMoveMode = () => useAnnotationWork.getState().mode?.kind === 'move' const inMoveMode = () => useAnnotationWork.getState().mode?.kind === 'move'
/** /**
* Delete (or Enter on « − ») removes the chosen vertex; the next one is chosen so the focus * Delete, Backspace (or Enter on « − ») removes the chosen vertex; the next one is chosen so
* stays on a vertex (ZoneHandles follows the choice). * the focus stays on a vertex (ZoneHandles follows the choice).
*/ */
function deleteChosen(input: ZoneEditInput): void { function deleteChosen(input: ZoneEditInput): void {
const id = input.target?.id const id = input.target?.id
@@ -209,19 +209,18 @@ describe('a vertex (R-9)', () => {
expect(message()).toHaveTextContent('Sommet ajouté') expect(message()).toHaveTextContent('Sommet ajouté')
}) })
it('undo after « + » drops the chosen vertex: « − » removes nothing stale (Review Focus 2)', async () => { it('undo after « + » drops the chosen vertex: no stale « − » (Review Focus 2)', async () => {
await mount(squareText()) await mount(squareText())
render(<UndoKeys />) render(<UndoKeys />)
await select() await select()
clickHandle('Ajouter un sommet après le sommet 1 de N', [50, 20]) clickHandle('Ajouter un sommet après le sommet 1 de N', [50, 20])
const bubble = hitOf('Retirer le sommet 2 de N') hitOf('Retirer le sommet 2 de N')
fireEvent.keyDown(document.body, { key: 'z', ctrlKey: true }) fireEvent.keyDown(document.body, { key: 'z', ctrlKey: true })
expect(pointsOf('z')).toEqual(SQUARE) expect(pointsOf('z')).toEqual(SQUARE)
expect(chosen()).toBeNull() expect(chosen()).toBeNull()
expect( expect(
screen.queryByRole('button', { name: /^Retirer le sommet/ }), screen.queryByRole('button', { name: /^Retirer le sommet/ }),
).toBeNull() ).toBeNull()
void bubble
const after = depth() const after = depth()
// (A vertex key acts on its own handle, so it is not a stale case; only the bubble is.) // (A vertex key acts on its own handle, so it is not a stale case; only the bubble is.)
// A press where the bubble was reaches what is there now: a bubble still shown, else the // A press where the bubble was reaches what is there now: a bubble still shown, else the
@@ -242,7 +241,7 @@ describe('a vertex (R-9)', () => {
expect(message()).toHaveTextContent('Sommet retiré') expect(message()).toHaveTextContent('Sommet retiré')
}) })
it('Backspace removes and « + » inserts like Delete and Insert, one commit each, the default prevented', async () => { it('Backspace removes and « + » inserts like Delete and Insert, one commit each', async () => {
await mount(squareText()) await mount(squareText())
await select() await select()
const before = depth() const before = depth()