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:
1 parent
db3f306523
commit
9a0fe3784c
12 files changed
+234
-58
No files matched your search
@@ -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()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user