From a5af9bdd4fd00fb8e68752b0520e9aeab08ffc3c Mon Sep 17 00:00:00 2001 From: bchanot Date: Wed, 18 Nov 2026 13:28:17 +0100 Subject: [PATCH] =?UTF-8?q?test(tests):=20measure=20the=20line's=20=C2=AB?= =?UTF-8?q?=20D=C3=A9faire=20=C2=BB=20hit=20box=20whole?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Final review M-5: the hit test now probes 1 px inside each edge of the 44 px (36 px from xl) box and reads the ::before height, so the check proves the full height, not 42 px. Tests: no assertion removed. --- apps/app/e2e/shell/editor-annotations.spec.ts | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/apps/app/e2e/shell/editor-annotations.spec.ts b/apps/app/e2e/shell/editor-annotations.spec.ts index 32b9cb8a..02b1f170 100644 --- a/apps/app/e2e/shell/editor-annotations.spec.ts +++ b/apps/app/e2e/shell/editor-annotations.spec.ts @@ -427,24 +427,25 @@ test.describe('editor annotations (A3)', () => { button.scrollIntoView({ block: 'center' }), ) const reach = width < 1280 ? 44 : 36 - const hit = await undoOnLine.evaluate( - (button, half) => { - const box = button.getBoundingClientRect() - const x = box.left + box.width / 2 - const mid = box.top + box.height / 2 - const at = (dy: number) => document.elementFromPoint(x, mid + dy) - const pill = button.closest('[data-testid="gesture-message"]')! - return { - top: at(-half) === button, - bottom: at(half) === button, - pill: pill.getBoundingClientRect().height, - } - }, - reach / 2 - 1, - ) + // Hit-tested 1 px inside each edge, and the hit box measured whole. + const hit = await undoOnLine.evaluate((button, tall) => { + const box = button.getBoundingClientRect() + const x = box.left + box.width / 2 + const mid = box.top + box.height / 2 + const at = (dy: number) => document.elementFromPoint(x, mid + dy) + const pill = button.closest('[data-testid="gesture-message"]')! + const area = getComputedStyle(button, '::before').height + return { + top: at(1 - tall / 2) === button, + bottom: at(tall / 2 - 1) === button, + tall: parseFloat(area) >= tall, + pill: pill.getBoundingClientRect().height, + } + }, reach) expect(hit, `a ${reach} px hit area at ${width} px`).toEqual({ top: true, bottom: true, + tall: true, pill: 36, }) // M-4: the line's « Défaire »: the drawing takes the focus, nothing moves or scrolls.