Closed mferber closed 3 years ago
It is one developer’s opinion - mine - but since I’m the only developer on enzyme, it’s also an official statement.
Avoid use of simulate in all code, new or otherwise. It doesn’t faithfully simulate anything.
Thank you! (I win the argument. :-) )
Wait, so if I want to do fire a onChange event, I should not use .simulate('change', { target: { value: "someValue" } })
?
If so what is the correct way to do it? .props().onChange()
?
@arvinsim yes, precisely, altho you can also do .invoke('onChange')({ target: { value: 'someValue' } })
.
Issue #2173 (June 2019) says simulate() is deprecated, but as of mid-2021 the docs haven't been updated. The issue says "A PR to make this clear in the docs would be welcomed," but the resulting PR (https://github.com/enzymejs/enzyme/pull/2182) has been sitting around unmerged for 2 years. Should we still consider the deprecation an official statement, or was that just one developer's opinion?
(Reason for asking: disagreement over whether to use simulate() in new code)