Skip to content

Commit c546a6f

Browse files
authoredSep 13, 2020
fix: Trigger ongot-/onlostpointercapture when calling got-/lostpointercapture (#786)
1 parent 732f3a1 commit c546a6f

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"license": "MIT",
4545
"dependencies": {
4646
"@babel/runtime": "^7.11.2",
47-
"@testing-library/dom": "^7.23.0"
47+
"@testing-library/dom": "^7.24.2"
4848
},
4949
"devDependencies": {
5050
"@testing-library/jest-dom": "^5.11.4",

‎src/__tests__/events.js

+16-20
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,22 @@ const eventTypes = [
6262
],
6363
elementType: 'button',
6464
},
65+
{
66+
type: 'Pointer',
67+
events: [
68+
'pointerOver',
69+
'pointerEnter',
70+
'pointerDown',
71+
'pointerMove',
72+
'pointerUp',
73+
'pointerCancel',
74+
'pointerOut',
75+
'pointerLeave',
76+
'gotPointerCapture',
77+
'lostPointerCapture',
78+
],
79+
elementType: 'button',
80+
},
6581
{
6682
type: 'Selection',
6783
events: ['select'],
@@ -197,26 +213,6 @@ test('onChange works', () => {
197213
expect(handleChange).toHaveBeenCalledTimes(1)
198214
})
199215

200-
test('calling `onPointerEnter` directly works too', () => {
201-
const handlePointerEnter = jest.fn()
202-
const handlePointerLeave = jest.fn()
203-
const {container} = render(
204-
<div>
205-
<button
206-
onPointerEnter={handlePointerEnter}
207-
onPointerLeave={handlePointerLeave}
208-
/>
209-
</div>,
210-
)
211-
const button = container.firstChild.firstChild
212-
213-
fireEvent.pointerEnter(button)
214-
expect(handlePointerEnter).toHaveBeenCalledTimes(1)
215-
216-
fireEvent.pointerLeave(button)
217-
expect(handlePointerLeave).toHaveBeenCalledTimes(1)
218-
})
219-
220216
test('calling `fireEvent` directly works too', () => {
221217
const handleEvent = jest.fn()
222218
const {

0 commit comments

Comments
 (0)
Please sign in to comment.