fix(editor): veil ignores clicks, names merged apart, honest tests

U2 Task 6 fix round 1 (review minors 1 to 9).

- R-6: `Dialog` takes `veilCloses`; the annotation dialog passes false,
  so its veil ignores clicks centred too. Other dialogs unchanged.
- Save merges each name on its own (an EN refreshed meanwhile survives
  an FR-only edit); the merged annotation is typed per kind, no cast.
- Tests: the category change and the region row really run (a second
  category and a region in the fixture); EN kept under an FR edit;
  focus to the drawing when a filter hides the row; a centred veil
  ignores a click; act() around the store write; ui.Dialog restores
  innerHeight and visualViewport after each test.
- e2e: `pickAnnotation` no longer scrolls; `scrollToTop` is explicit
  where a low row leaves the drawing out of view (editor-zones x3,
  editor-geometry). editor-geometry runs the accepted repair from the
  page's end, buttons pressed in place, scroll unchanged. The touch
  and double-click tests wait on the clicks themselves; the stray
  click on the veil can fail.
- CreationPanel's `required.fields` recorded as a shortcut for Task 7;
  TODO lines updated. focusTarget comment wrapped.
This commit is contained in:
bchanot committed 2026-11-17 22:47:02 +01:00
1 parent db3f306523
commit 9a0fe3784c
12 files changed
+234 -58

No files matched your search

+13 -5
View File
@@ -22,6 +22,7 @@ import {
shapeWith,
standardShape,
openProperties,
scrollToTop,
} from '../support/editor'
// V1-2.6 geometry and adversarial cases (contract C7, C8, C21; owner 2026-11-04): a click
@@ -211,8 +212,8 @@ 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), wherever the page is scrolled: the issue
// lives in the strip and the dialog, the side column keeps the overview (U2 Task 6).
// Nothing around the drawing moves (A14), from the page's top here.
await scrollToTop(page)
await expectNoShift(page, () => move.click())
await dragInMode(page, { x: 250, y: 250 }, { x: 260, y: 260 })
await expectNoShift(page, async () => {
@@ -226,13 +227,20 @@ test.describe('editor geometry (adversarial)', () => {
await expect(shownShape(page)).toHaveAttribute('cx', '110')
await expect(verification).toContainText(String(errorsBefore))
// Far enough inside: kept, the issue gone, one error less.
await expectNoShift(page, () => move.click())
// Far enough inside, from the page's end: kept, the issue gone, one error less. The
// issue leaving no longer shortens the page (it lives in the strip and the dialog, the
// side column keeps the overview, U2 Task 6), so the scroll clamp moves nothing. The
// buttons are pressed in place (no scroll into view), the page stays at its end.
await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight))
const end = await page.evaluate(() => window.scrollY)
expect(end, 'the page scrolls: its end is not its top').toBeGreaterThan(0)
await expectNoShift(page, () => move.dispatchEvent('click'))
await dragInMode(page, { x: 250, y: 250 }, { x: 290, y: 290 })
await expectNoShift(page, async () => {
await confirm.click()
await confirm.dispatchEvent('click')
await expect(notice).not.toContainText(issue)
})
expect(await page.evaluate(() => window.scrollY)).toBe(end)
expect(Math.abs((await shownNumber(page, 'cx')) - 150)).toBeLessThan(2)
const after = (await verification.innerText()).replace(/\D/g, '')
expect(Number(after || 0)).toBeLessThan(errorsBefore)
+32 -6
View File
@@ -3,7 +3,6 @@ import type { CDPSession, Page, TestInfo } from '@playwright/test'
import { expect, expectAccessible, test } from '../support/browser'
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
import {
clickDrawing,
clientOf,
editorActor,
openEditor,
@@ -60,6 +59,27 @@ const dialog = (page: Page) => page.getByRole('dialog')
const box = async (page: Page, selector: string) =>
(await page.locator(selector).locator('visible=true').first().boundingBox())!
/**
* Counts the clicks and double clicks the document receives, from now on, in the capture
* phase before any other listener: a wait on the click itself, never on a delay.
*/
async function countClicks(page: Page) {
await page.evaluate(() => {
const scope = window as unknown as { __clicks: Record<string, number> }
scope.__clicks = { click: 0, dblclick: 0 }
for (const type of ['click', 'dblclick'])
document.addEventListener(type, () => (scope.__clicks[type] += 1), true)
})
return (type: 'click' | 'dblclick') =>
page.evaluate(
(kind) =>
(window as unknown as { __clicks: Record<string, number> }).__clicks[
kind
],
type,
)
}
type TouchPoint = { x: number; y: number }
const touch = (
cdp: CDPSession,
@@ -185,9 +205,11 @@ test.describe('the properties dialog (U2 Task 6)', () => {
await pickAnnotation(page, dict, ZONE)
const before = await shownPoints(page)
const inside = await clientOf(page, 250, 250)
const clicks = await countClicks(page)
await page.mouse.dblclick(inside.x, inside.y)
await expect(dialog(page)).toBeVisible()
await page.waitForTimeout(500)
// The second click and the dblclick have landed (on the veil): the dialog stays.
await expect.poll(() => clicks('dblclick')).toBe(1)
expect(await clicks('click')).toBe(2)
await expect(dialog(page)).toBeVisible()
await page.keyboard.press('Escape')
await expect(dialog(page)).toHaveCount(0)
@@ -252,13 +274,17 @@ test.describe('the properties dialog by touch (U2 Task 6, Review Focus 5)', () =
await pickAnnotation(page, dict, ZONE)
const cdp = await context.newCDPSession(page)
const inside = await clientOf(page, 250, 250)
const clicks = await countClicks(page)
await touch(cdp, 'touchStart', [inside])
await touch(cdp, 'touchEnd', [])
await expect(dialog(page)).toBeVisible()
await page.waitForTimeout(500)
// The click the browser synthesises after the tap has landed: the dialog stays open.
await expect.poll(() => clicks('click')).toBe(1)
await expect(dialog(page)).toBeVisible()
await expect(selectionTag(page)).toContainText(ZONE)
await clickDrawing(page, 900, 600).catch(() => undefined)
// A stray click on the veil, over the drawing (R-6): it lands, nothing closes.
const stray = await clientOf(page, 900, 600)
await page.mouse.click(stray.x, stray.y)
await expect.poll(() => clicks('click')).toBe(2)
await expect(dialog(page)).toBeVisible()
})
})
+7
View File
@@ -13,6 +13,7 @@ import {
selectionTag,
shownPoints,
toolButton,
scrollToTop,
} from '../support/editor'
import { expectNoShift } from '../support/layout'
@@ -133,6 +134,8 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
const actor = await openThoracic(page)
requests.forbid(actor.account.email, actor.account.password)
await pickAnnotation(page, dict, THORACIC)
// The row sits low in the equine list: the click left the drawing out of view.
await scrollToTop(page)
await expect(selectionTag(page)).toContainText('Vertèbres thoraciques')
await expect(handle(page, 'Sommet 9')).toBeAttached()
// R-18: at fit zoom some segments are too short for their « + ».
@@ -225,6 +228,8 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
const actor = await openThoracic(page)
requests.forbid(actor.account.email, actor.account.password)
await pickAnnotation(page, dict, THORACIC)
// The row sits low in the equine list: the click left the drawing out of view.
await scrollToTop(page)
const stored = await shownPoints(page)
// Accepted: four clicks, « Fermer le tracé », one commit, every property kept.
@@ -284,6 +289,8 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
// Thoraciques selected: zoomed at C7-T1 so that its vertex handles leave room, a click
// inside both shapes still selects the point (the selection's interior comes after).
await pickAnnotation(page, dict, THORACIC)
// The row sits low in the equine list: the click left the drawing out of view.
await scrollToTop(page)
const at = await clientOf(page, 870, 515)
await page.mouse.move(at.x, at.y)
await page.keyboard.down('Control')