-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Simulate does not merge arguments correctly #1114
Comments
@lelandrichardson Has this issue be resolved? Or have I misused it? Just closing it without any information is a bit harsh... |
if you change the first level property from |
Do you mean like this? const test = mount(<input type="checkbox" onChange={(e) => console.log(e.foo.checked)} />);
test.find('input').simulate('change', {foo: {checked: true}}); This is returning |
I have also confirmed that @lelandrichardson @danrot, sounds like the merge is backwards. Edit: the merge looks fine in react-dom/test-utils... |
Not sure if this is related to this issue, but multiple arguments doesn't seem to behave as expected either (it works with const wrapper = mount(<div onChange={(e, data) => console.log("data:", data)}>content</div>);
wrapper.find("div").simulate("change", {}, "some data");
// it will log "data: undefined" instead of "data: some data" |
I am using enzyme 2.9.1 (and jest, if this might be somehow connected to the issue), and I am trying to test something that involves a checkbox. But IMO the second parameter of the
simulate
method doesn't work correctly... I have narrowed it down to the following code:The
console.log
here should printtrue
IMO, but it actually printsfalse
. It feels like the second parameter of thesimulate
call are merged in the wrong way, because the following printstrue
as I would expect:Am I doing something wrong, or is that really a bug?
The text was updated successfully, but these errors were encountered: