Skip to content

Commit 75edef5

Browse files
authored
fix(pointer): check PointerCoords.x in isDifferentPointerPosition (#1216)
1 parent 8528972 commit 75edef5

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/system/pointer/shared.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function isDifferentPointerPosition(
2727
) {
2828
return (
2929
positionA.target !== positionB.target ||
30-
positionA.coords?.x !== positionB.coords?.y ||
30+
positionA.coords?.x !== positionB.coords?.x ||
3131
positionA.coords?.y !== positionB.coords?.y ||
3232
positionA.caret?.node !== positionB.caret?.node ||
3333
positionA.caret?.offset !== positionB.caret?.offset

tests/pointer/move.ts

+21
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,24 @@ test('declare pointer coordinates', async () => {
129129
expect(getEvents('mouseover')[0]).toHaveProperty(prop, value)
130130
})
131131
})
132+
133+
test('move pointer by x/y coords', async () => {
134+
const {elements, getEventSnapshot, user} = setup('<div></div>')
135+
136+
await user.pointer([
137+
{keys: '[MouseLeft>]', target: elements[0], coords: {x: 20, y: 20}},
138+
{coords: {x: 40, y: 20}},
139+
{coords: {x: 40, y: 40}},
140+
])
141+
142+
expect(getEventSnapshot()).toMatchInlineSnapshot(`
143+
Events fired on: div
144+
145+
div - pointerdown
146+
div - mousedown: primary
147+
div - pointermove
148+
div - mousemove
149+
div - pointermove
150+
div - mousemove
151+
`)
152+
})

0 commit comments

Comments
 (0)