test(tests): measure the line's « Défaire » hit box whole
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.
This commit is contained in:
1 parent
f2bf442ecd
commit
a5af9bdd4f
1 file changed
+16
-15
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user