Proper way to bypass assertPointerEvents in user.click #841
-
While writing tests I often get into trouble trying to Most of the time, it means there is an issue with the UI code, not with const userWithoutPointerEventsCheck = userEvent.setup({
pointerEventsCheck: PointerEventsCheckLevel.Never,
}); Would it make sense to allow passing the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
No it's not a deliberate choice to make it hard for users, but it was a deliberate choice to remove most options from the interaction APIs. I don't think that this... const user = userEvent.setup()
await user.click(element) // click with pointer-events check
await user.setup({pointerEventsCheck: PointerEventsCheckLevel.Never}).click(element) // click without pointer-events check
await user.click(element) // continue with pointer-events check ... is harder to use than ... const user = userEvent.setup()
await user.click(element) // click with pointer-events check
await user.click(element, {pointerEventsCheck: PointerEventsCheckLevel.Never}) // click without pointer-events check
await user.click(element) // continue with pointer-events check But the implementation code for the latter requires either an internal call to setup in every API or it requires passing down the options internally (as it was before) which results in a lot of copy-paste-code. It unnecessarily mixes concerns and results in repetitive code. |
Beta Was this translation helpful? Give feedback.
No it's not a deliberate choice to make it hard for users, but it was a deliberate choice to remove most options from the interaction APIs.
I don't think that this...
... is harder to use than ...