-
Notifications
You must be signed in to change notification settings - Fork 727
docs: fix fireEvent Example code #1019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: fix fireEvent Example code #1019
Conversation
buttonNode, | ||
new Event('MouseEvent', { | ||
bubbles: true, | ||
cancelable: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix, though I would like to re-add the button
property.
cancelable: true, | |
cancelable: true, | |
button: 0 |
button
is a valid event property - https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button - and it's also implemented like this in fireEvent - https://github.com/testing-library/dom-testing-library/blob/main/src/event-map.js#L82.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pppp606 is correct. There is no button
property on Event
. It is implemented on MouseEvent
.
https://codesandbox.io/s/event-property-button-p6w8xh?file=/src/index.test.js
Co-authored-by: Philipp Fritsche <ph.fritsche@gmail.com>
@timdeschryver @ph-fritsche |
@all-contributors please add @pppp606 for docs |
I've put up a pull request to add @pppp606! 🎉 |
When I copied the code example, there was an error, so I fixed it.
https://testing-library.com/docs/preact-testing-library/api/#example-1