fix(editor): no lost series, tap click absorbed, focus kept on handles
Task 5 review fix round 1. - I-1: Insert and Delete on a vertex commit pending arrow steps first, then act on the stored polygon (read from the store, not the render). - I-2: deselect commits a handle's pending series before the handle unmounts (commitFocusedSeries, no reliance on blur at removal). - I-3: a touch or pen tap absorbs the click the browser synthesises at its place, once, within 400 ms and 8 px; mouse and later clicks pass. Scroll anchoring is off while the editor shows: the deselect's panel swap scrolled the drawing under the finger. editor-deselect step c is back at the page's end, and asserts the drawing does not move. - I-4, M-2: the double-click and undo tests press what is there now; a hand-set stale chosen vertex removes nothing. - I-5: editor-zones undos, the vertex choice and the refused-trace clicks run under expectNoShift; new e2e for I-2. - M-1: Delete on the last vertex and Enter on « − » keep the focus on a vertex (the next one is chosen). - M-4: the strip notice comment names R-18. M-5: the tracing carries a `refused` flag; only a refused close titles « Fermeture refusée ». - M-7: TODO lines (bubble size shortcut, scroll-padding-top, scroll clamp at the page's end). Rewritten assertions: zone-edit « − » double click and undo-then-« − » pressed the detached bubble -> press the live bubble or the box at the same place. editor-deselect step c: scroll-to-top removed, drawing y asserted unchanged. editor-geometry: scroll-to-top kept with the clamp named (reported, TODO). editor-zones and editor-journey: comment says the scroll-to-top undoes Playwright's own auto-scroll.
This commit is contained in:
1 parent
316d8c475c
commit
e596e0765e
17 files changed
+395
-57
No files matched your search
@@ -617,11 +617,6 @@ test.describe('deselect and D6b (touch, editor at 1 280 px)', () => {
|
||||
// c. Within 36 px of the canvas bottom, above the add buttons.
|
||||
await select(page, POINT)
|
||||
await takeRecord(page)
|
||||
// U2 Task 5: without the coordinate fields the properties panel is shorter than the
|
||||
// overview, so with the page scrolled to its end the deselect's swap (aside content,
|
||||
// until Task 6) grows the page and scrolls it before the tap's click lands. The tap
|
||||
// is made from the top of the page; the hazard is reported for Task 6.
|
||||
await page.evaluate(() => window.scrollTo(0, 0))
|
||||
await box(page).scrollIntoViewIfNeeded()
|
||||
const rect = (await box(page).boundingBox())!
|
||||
const bottom = { x: rect.x + rect.width / 2, y: rect.y + rect.height - 36 }
|
||||
@@ -630,6 +625,8 @@ test.describe('deselect and D6b (touch, editor at 1 280 px)', () => {
|
||||
await tap(cdp, bottom)
|
||||
await expectDeselected(page)
|
||||
await expect(creationPanel(page)).toHaveCount(0)
|
||||
// The page ends lower once the overview is back: the drawing stays where it was.
|
||||
expect((await box(page).boundingBox())!.y).toBe(rect.y)
|
||||
await report('c tap 36 px above the canvas bottom')
|
||||
|
||||
// d. About 6 px outside a marker: the marker or nothing, never both.
|
||||
|
||||
@@ -201,9 +201,9 @@ test.describe('editor geometry (adversarial)', () => {
|
||||
// A partial move (still out of the frame): refused by the core, the point restored.
|
||||
// Nothing around the drawing moves (A14); the side panel's content may (Task 6).
|
||||
const swaps = ['aside-content'] as const
|
||||
// The list row scrolled the page to its end. Without the coordinate fields (U2 Task 5)
|
||||
// the panel is short enough that the issue list leaving it (aside content, exempt until
|
||||
// Task 6) would clamp that scroll: the check starts from the top.
|
||||
// NOT a Playwright artefact: at the page's end, the issue list leaving the panel shortens
|
||||
// the page by 11 px and the scroll clamp moves the canvas (reported, U2 Task 5 fix round
|
||||
// 1; Task 6 moves the panel out of the page). The check starts from the top.
|
||||
await page.evaluate(() => window.scrollTo(0, 0))
|
||||
await expectNoShift(page, () => move.click(), swaps)
|
||||
await dragInMode(page, { x: 250, y: 250 }, { x: 260, y: 260 })
|
||||
|
||||
@@ -316,8 +316,7 @@ 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.
|
||||
// Playwright's auto-scroll to the last list row left « Enregistrer » under the top bar.
|
||||
await page.evaluate(() => window.scrollTo(0, 0))
|
||||
await expectAccessible(page, 'the editor with annotations')
|
||||
await saveDraft(page, dict, 1)
|
||||
|
||||
@@ -78,6 +78,22 @@ const button = (page: Page, key: string) =>
|
||||
page.getByRole('button', { name: dict[key], exact: true })
|
||||
const undo = (page: Page) => page.keyboard.press('Control+z')
|
||||
|
||||
/** An undo back to `points`, nothing around the drawing moving (A14). */
|
||||
async function undoTo(
|
||||
page: Page,
|
||||
points: () => Promise<unknown>,
|
||||
expected: unknown,
|
||||
) {
|
||||
await expectNoShift(
|
||||
page,
|
||||
async () => {
|
||||
await undo(page)
|
||||
await expect.poll(points).toEqual(expected)
|
||||
},
|
||||
SWAPS,
|
||||
)
|
||||
}
|
||||
|
||||
/** A press and release at the centre of a handle's hit shape. */
|
||||
async function pressHandle(page: Page, name: string) {
|
||||
const box = (await handle(page, name).locator('[data-handle]').boundingBox())!
|
||||
@@ -128,7 +144,7 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
|
||||
await expect(page.getByTestId('edit-strip-notice')).toContainText(
|
||||
dict['editor.annotations.strip.zoom_hint'],
|
||||
)
|
||||
// The list row scrolled the page: the shell's top bar would cover the header's buttons.
|
||||
// Playwright's auto-scroll to the list row left the header under the sticky top bar.
|
||||
await page.evaluate(() => window.scrollTo(0, 0))
|
||||
await expectAccessible(page, 'a selected zone: vertices and « + »')
|
||||
const stored = await shownPoints(page)
|
||||
@@ -146,8 +162,7 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
|
||||
)
|
||||
const [, moved] = await shownPoints(page)
|
||||
expect(Math.abs(moved[1] - 620)).toBeLessThan(3)
|
||||
await undo(page)
|
||||
await expect.poll(() => shownPoints(page)).toEqual(stored)
|
||||
await undoTo(page, () => shownPoints(page), stored)
|
||||
|
||||
// « + » on the segment from vertex 2: a vertex added and chosen, then undone.
|
||||
await expectNoShift(
|
||||
@@ -164,11 +179,19 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
|
||||
await expect(page.getByTestId('edit-strip-detail')).toContainText(
|
||||
'sommet 3 choisi',
|
||||
)
|
||||
await undo(page)
|
||||
await expect.poll(() => count(page)).toBe(9)
|
||||
await undoTo(page, () => count(page), 9)
|
||||
|
||||
// « − » on the chosen vertex 3, then undone.
|
||||
await pressHandle(page, 'Sommet 3')
|
||||
await expectNoShift(
|
||||
page,
|
||||
async () => {
|
||||
await pressHandle(page, 'Sommet 3')
|
||||
await expect(page.getByTestId('edit-strip-detail')).toContainText(
|
||||
'sommet 3 choisi',
|
||||
)
|
||||
},
|
||||
SWAPS,
|
||||
)
|
||||
await expectNoShift(
|
||||
page,
|
||||
async () => {
|
||||
@@ -180,8 +203,7 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
|
||||
SWAPS,
|
||||
)
|
||||
expect(await count(page)).toBe(8)
|
||||
await undo(page)
|
||||
await expect.poll(() => shownPoints(page)).toEqual(stored)
|
||||
await undoTo(page, () => shownPoints(page), stored)
|
||||
|
||||
// The interior dragged by the mouse moves the zone as a block, then undone.
|
||||
await expectNoShift(
|
||||
@@ -196,8 +218,31 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
|
||||
)
|
||||
const [first] = await shownPoints(page)
|
||||
expect(Math.abs(first[0] - (stored[0][0] + 40))).toBeLessThan(3)
|
||||
await undo(page)
|
||||
await expect.poll(() => shownPoints(page)).toEqual(stored)
|
||||
await undoTo(page, () => shownPoints(page), stored)
|
||||
})
|
||||
|
||||
test('Thoraciques: « Désélectionner » commits the arrow steps pending on a vertex', async ({
|
||||
page,
|
||||
requests,
|
||||
}) => {
|
||||
const actor = await openThoracic(page)
|
||||
requests.forbid(actor.account.email, actor.account.password)
|
||||
await pickAnnotation(page, dict, THORACIC)
|
||||
const [, second] = await shownPoints(page)
|
||||
await handle(page, 'Sommet 2').focus()
|
||||
await page.keyboard.press('ArrowDown')
|
||||
// Not under expectNoShift: the button returns the focus to the list row, which
|
||||
// scrolls it into view by design.
|
||||
await page
|
||||
.getByTestId('annotation-properties')
|
||||
.getByRole('button', { name: dict['editor.annotations.deselect'] })
|
||||
.click()
|
||||
await expect(line(page)).toContainText(
|
||||
dict['editor.annotations.message.vertex_moved'],
|
||||
)
|
||||
await pickAnnotation(page, dict, THORACIC)
|
||||
const [, after] = await shownPoints(page)
|
||||
expect(after[1]).toBeGreaterThan(second[1])
|
||||
})
|
||||
|
||||
test('Thoraciques: redraw accepted, then refused, the old outline kept meanwhile', async ({
|
||||
@@ -235,17 +280,20 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
|
||||
)
|
||||
await expect(selectionTag(page)).toContainText('Vertèbres thoraciques')
|
||||
expect(await count(page)).toBe(4)
|
||||
await undo(page)
|
||||
await expect.poll(() => shownPoints(page)).toEqual(stored)
|
||||
await undoTo(page, () => shownPoints(page), stored)
|
||||
|
||||
// Refused: a sliver; the tracing stays open with the core's message, then cancelled.
|
||||
await button(page, 'editor.annotations.redraw').click()
|
||||
await expectNoShift(
|
||||
page,
|
||||
() => button(page, 'editor.annotations.redraw').click(),
|
||||
SWAPS,
|
||||
)
|
||||
for (const [x, y] of [
|
||||
[900, 450],
|
||||
[1100, 452],
|
||||
[1300, 455],
|
||||
])
|
||||
await clickAt(page, x, y)
|
||||
await expectNoShift(page, () => clickAt(page, x, y), SWAPS)
|
||||
await expectNoShift(
|
||||
page,
|
||||
async () => {
|
||||
|
||||
Reference in new issue
Block a user