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 c423f537..81a520ad 100644 --- a/tests/pointer/move.ts +++ b/tests/pointer/move.ts @@ -103,3 +103,23 @@ test('move touch over elements', async () => { div - click: primary `) }) + +test('move pointer by x coord', async () => { + const {elements, getEventSnapshot, user} = setup('
') + + // Only x changes + await user.pointer([ + {keys: '[MouseLeft>]', target: elements[0], coords: {x: 20, y: 20}}, + {keys: '[/MouseLeft]', target: elements[0], coords: {x: 40, y: 20}}, + ]) + + expect(getEventSnapshot()).toMatchInlineSnapshot(` + Events fired on: div + + div - pointerdown + div - mousedown: primary + div - pointerup + div - mouseup: primary + div - click: primary + `) +})