feat(editor): vertex handles, insert and remove, zone move, redraw
U2 Task 5. A selected polygon gets its vertex, « + » and « − » handles (R-9, hidden « + » under two hit radii, R-18 zoom hint in the strip), the handle cap at 40 (R-7), vertex drag and keys, the move mode on the zone or the chosen vertex, « Redessiner » as a redraw mode kept in step with its tracing (R-12 guard, R-13 drop), close radius in CSS px (R-11). The numeric group leaves the properties panel (D1). Removed or rewritten assertions (numeric group -> replacement): - tab « shows its exact stored numbers » (Centre x field) -> the overlay selection circle's cx attribute, same exact value. - tab « a numeric edit » x3 -> « an edit on the drawing »: Enter on the handle without a step commits nothing, a step + Enter commits once; a refused handle drag keeps the stored shape then a drag inside the frame repairs it (issues gone); Escape drops a pending series. - tab C26 « Centre x 15 » -> overlay cx 15. - tab C32 unmeasured « Centre x as text » -> no handle, no field. - tab « adds and removes a vertex as part of the whole group » -> « + » then « − » on the drawing; « never offers to remove below three » -> « − » aria-disabled at 3. - tab H8 « refused Remplacer drops the tracing » -> keeps it open with « Fermeture refusée » (board 33 A); « refused vertex add/remove stay non appliqué » -> a refused vertex drag restores the shape exactly. - tab Désélectionner and D6b (typed Centre x committed, refused, undone) x6 and strip « a new commit replaces the message » -> the same with the Nom (FR) field (a blank name is the refused value). - focus-request « Centre x 20 » -> overlay cx 20. - escape « strip commands keep their Escape » -> a redraw: Escape on the strip or the box cancels it (R-12 row 4); kept for a new zone tracing. - keep-alive « Remplacer tracing kept across Aller à » -> ended by a tab when empty, asked once a vertex is placed (R-12). - e2e annotations: numeric cx edit + undo/redo -> handle keys + undo/ redo; jitter/drag and Task 4 point reads -> overlay attributes (the stored place during the mode -> overlay-old-place); keyboard-only cy and vertex x typed -> handle and vertex keys. - e2e deselect: Centre x typed/refused/committed -> Nom (FR). - e2e geometry, shell-crossing: Centre x/cy reads -> overlay attributes. - e2e journey: cx +3 and vertex x +4 typed -> 3 and 4 arrow steps + Enter; a far typed value + revert -> a far handle drag refused. - e2e equine latency: typed cx rounds -> handle arrow + Enter rounds.
This commit is contained in:
1 parent
ba8e766fe8
commit
6211046537
44 files changed
+3790
-1050
No files matched your search
@@ -6,12 +6,16 @@ import { expect, expectAccessible, test } from '../support/browser'
|
||||
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
|
||||
import {
|
||||
clickDrawing,
|
||||
clientOf,
|
||||
closeFinding,
|
||||
createFromPanel,
|
||||
creationPanel,
|
||||
editorActor,
|
||||
fillCreation,
|
||||
geometryField,
|
||||
round2,
|
||||
shownNumber,
|
||||
shownPoints,
|
||||
shownShape,
|
||||
historyButton,
|
||||
INKSCAPE_EXPORT,
|
||||
openDraft,
|
||||
@@ -185,28 +189,52 @@ async function createAnnotations(page: Page) {
|
||||
|
||||
const MODIFIED = { point: 3, vertex: 4 }
|
||||
|
||||
/** Applies (not only refuses) changes to a point, a zone and a link; read back at the save. */
|
||||
/**
|
||||
* `steps` arrow presses on the focused handle (one unit each on this 200-unit drawing,
|
||||
* R-11), then Enter: one commit. Returns where `from` lands, rounded as the page does.
|
||||
*/
|
||||
async function stepRight(
|
||||
page: Page,
|
||||
handle: Locator,
|
||||
from: number,
|
||||
steps: number,
|
||||
) {
|
||||
await handle.focus()
|
||||
let to = from
|
||||
for (let step = 0; step < steps; step++) {
|
||||
await page.keyboard.press('ArrowRight')
|
||||
to = round2(to + 1)
|
||||
}
|
||||
await page.keyboard.press('Enter')
|
||||
return to
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies (not only refuses) changes to a point, a zone and a link; read back at the save.
|
||||
* U2 Task 5: the point and the vertex move by their handle keys (no coordinate field).
|
||||
*/
|
||||
async function modifyAnnotations(page: Page) {
|
||||
await pickAnnotation(page, dict, /Point essai/)
|
||||
const cx = geometryField(page, dict, 'cx')
|
||||
const before = Number(await cx.inputValue())
|
||||
await commitText(cx, String(before + MODIFIED.point))
|
||||
await expect(cx).toHaveValue(String(before + MODIFIED.point))
|
||||
const before = await shownNumber(page, 'cx')
|
||||
const handle = page.getByTestId('point-handle')
|
||||
const point = await stepRight(page, handle, before, MODIFIED.point)
|
||||
await expect(shownShape(page)).toHaveAttribute('cx', String(point))
|
||||
await pickAnnotation(page, dict, /Zone dessinée/)
|
||||
const vertex = page.getByLabel(
|
||||
dict['editor.annotations.geometry.vertex_x'].replace('{n}', '1'),
|
||||
)
|
||||
const start = Number(await vertex.inputValue())
|
||||
await commitText(vertex, String(start + MODIFIED.vertex))
|
||||
await expect(vertex).toHaveValue(String(start + MODIFIED.vertex))
|
||||
const [[start]] = await shownPoints(page)
|
||||
const first = page.getByRole('button', { name: 'Sommet 1', exact: true })
|
||||
const vertex = await stepRight(page, first, start, MODIFIED.vertex)
|
||||
await expect.poll(async () => (await shownPoints(page))[0][0]).toBe(vertex)
|
||||
await pickAnnotation(page, dict, /Accès essai/)
|
||||
await commitText(page.locator('#annotation-name-fr'), 'Accès modifié')
|
||||
await page.locator('#annotation-laterality').selectOption('bilateral')
|
||||
await expect(page.locator('#annotation-name-fr')).toHaveValue('Accès modifié')
|
||||
return { point: before + MODIFIED.point, vertex: start + MODIFIED.vertex }
|
||||
return { point, vertex }
|
||||
}
|
||||
|
||||
/** Guide 4.4: a click near the edge proposes a position; a far value is refused. */
|
||||
/**
|
||||
* Guide 4.4: a click near the edge proposes a position; a far place is refused (U2 Task
|
||||
* 5: dragged by the handle, the coordinate fields left the panel).
|
||||
*/
|
||||
async function repairGeometry(page: Page) {
|
||||
await toolButton(page, dict, 'point').click()
|
||||
// On this 200 x 150 drawing the core keeps a shrunk marker at 1 unit from the edge: the
|
||||
@@ -216,16 +244,20 @@ async function repairGeometry(page: Page) {
|
||||
await fillCreation(page, dict, { fr: 'Point de bord', en: 'Edge point' })
|
||||
await createFromPanel(page, dict)
|
||||
await expect(selectionTag(page)).toContainText('Point de bord')
|
||||
const cx = geometryField(page, dict, 'cx')
|
||||
await cx.fill('9999')
|
||||
await cx.press('Enter')
|
||||
await expect(
|
||||
page.getByText(dict['editor.annotations.geometry.unapplied']),
|
||||
).toBeVisible()
|
||||
await clickButton(page, dict['editor.annotations.geometry.revert'])
|
||||
await expect(
|
||||
page.getByText(dict['editor.annotations.geometry.unapplied']),
|
||||
).toHaveCount(0)
|
||||
// The point tool stays on after « Créer » (A7 lands with Task 7): the handle needs select.
|
||||
await toolButton(page, dict, 'select').click()
|
||||
const cx = String(await shownNumber(page, 'cx'))
|
||||
const cy = await shownNumber(page, 'cy')
|
||||
const from = await clientOf(page, Number(cx), cy)
|
||||
const to = await clientOf(page, 260, cy)
|
||||
await page.mouse.move(from.x, from.y)
|
||||
await page.mouse.down()
|
||||
await page.mouse.move(to.x, to.y, { steps: 6 })
|
||||
await page.mouse.up()
|
||||
await expect(page.getByTestId('gesture-message')).toContainText(
|
||||
dict['editor.annotations.message.move_refused'].split(' :')[0],
|
||||
)
|
||||
await expect(shownShape(page)).toHaveAttribute('cx', cx)
|
||||
}
|
||||
|
||||
/** Guide 4.5: an unsaved change, a reload (beforeunload accepted), the offer, a restore. */
|
||||
@@ -284,6 +316,9 @@ test.describe('editor journey (owner trial steps)', () => {
|
||||
await historyButton(page, dict, 'undo').click()
|
||||
await historyButton(page, dict, 'redo').click()
|
||||
const modified = await modifyAnnotations(page)
|
||||
// The last list row scrolled the page: the shell's top bar would cover « Enregistrer »
|
||||
// (axe target-size); the shorter panel of U2 Task 5 made that scroll reach it.
|
||||
await page.evaluate(() => window.scrollTo(0, 0))
|
||||
await expectAccessible(page, 'the editor with annotations')
|
||||
await saveDraft(page, dict, 1)
|
||||
const draftId = await sql(
|
||||
|
||||
Reference in new issue
Block a user