diff --git a/src/system/pointer/shared.ts b/src/system/pointer/shared.ts index 04ef8eda..a00bb441 100644 --- a/src/system/pointer/shared.ts +++ b/src/system/pointer/shared.ts @@ -27,7 +27,7 @@ export function isDifferentPointerPosition( ) { return ( positionA.target !== positionB.target || - positionA.coords?.x !== positionB.coords?.y || + positionA.coords?.x !== positionB.coords?.x || positionA.coords?.y !== positionB.coords?.y || positionA.caret?.node !== positionB.caret?.node || positionA.caret?.offset !== positionB.caret?.offset diff --git a/tests/pointer/move.ts b/tests/pointer/move.ts index 3c9ccc1e..24aabead 100644 --- a/tests/pointer/move.ts +++ b/tests/pointer/move.ts @@ -129,3 +129,24 @@ test('declare pointer coordinates', async () => { expect(getEvents('mouseover')[0]).toHaveProperty(prop, value) }) }) + +test('move pointer by x/y coords', async () => { + const {elements, getEventSnapshot, user} = setup('
') + + await user.pointer([ + {keys: '[MouseLeft>]', target: elements[0], coords: {x: 20, y: 20}}, + {coords: {x: 40, y: 20}}, + {coords: {x: 40, y: 40}}, + ]) + + expect(getEventSnapshot()).toMatchInlineSnapshot(` + Events fired on: div + + div - pointerdown + div - mousedown: primary + div - pointermove + div - mousemove + div - pointermove + div - mousemove + `) +})