You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To simulate a pointer click, I might want to provide properties from the PointerEvent interface, such as:
// When simulating a mouse pointer inputfireEvent.click(button,{pointerId: 123,pointerType: 'mouse'});// When simulating a keyboard inputfireEvent.click(button,{pointerId: -1,pointerType: ''});
What you did:
I tried to simulate a pointerId property in a click event.
What happened:
The Jest code coverage reported that the if statement in my event handler
Reproduction:
I haven't done one in case the problem is obvious, but I am happy to create one if asked.
Problem description:
All browsers now treat a click event as a type of PointerEvent, not a MouseEvent. However, the @testing-library still treats them as MouseEvent types, so when I want to use properties like pointerId in tests, they get ignored.
Suggested solution:
Change auxclick, click and contextmenu events to PointerEvent types.
The text was updated successfully, but these errors were encountered:
Thanks for opening this @JoshTumath. fireEvent is a lower level API and should be used sparingly. AFAIR, user-event uses PointerEvents for clicks. Have you tried that?
@testing-library/dom
version: 9.3.4Relevant code or config:
To simulate a pointer click, I might want to provide properties from the
PointerEvent
interface, such as:What you did:
I tried to simulate a
pointerId
property in aclick
event.What happened:
The Jest code coverage reported that the
if
statement in my event handlerReproduction:
I haven't done one in case the problem is obvious, but I am happy to create one if asked.
Problem description:
All browsers now treat a
click
event as a type ofPointerEvent
, not aMouseEvent
. However, the@testing-library
still treats them asMouseEvent
types, so when I want to use properties likepointerId
in tests, they get ignored.Suggested solution:
Change
auxclick
,click
andcontextmenu
events toPointerEvent
types.The text was updated successfully, but these errors were encountered: