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
@@ -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