Closed DonBrody closed 5 days ago
The Fire Event API is invoking event handlers also on composite components due to compatibility reasons. If you want to have more realistic event simulation use User Event API instead.
Yup - the User Event API does properly handle this. We'll update our tests. Thanks for your help!
Describe the bug
Hi. I think I'm running into an issue where an
onPress
event is called even when it is not passed down as a prop, but only when including a wrapper component.For example, the component below accepts an
onPress
prop through its interface, but never passes that prop down to its internalText
component:So we'd expect that the following would fail (and it does fail as expected):
But the above will pass if a wrapper component is provided (even a simple one like below):
Thank you in advance for any help you could provide here!
Expected behavior
The test described above should fail.
Steps to Reproduce
Versions
@testing-library/react-native
=>12.5.1
jest
=>29.7.0
react
=>18.3.1
react-native
=>0.73.7
npmPackages: react: ^18.2.0 => 18.3.1 react-native: ~0.73.7 => 0.73.7