-
-
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
testing of setState call fails when compound component has few child components #1831
Comments
What's the output of What happens if you add a |
function onPress() {return _this.setState({ name: '::any name::' });}
I've tried and with update but the error message is same as code doesn't get to this point at all. it('bad case', () => {
const wrapper = shallow(
<MyComponent>
<MyChildComponent />
<MyChildComponent />
</MyComponent>
)
console.log(
wrapper
.find(MyChildComponent)
.first()
.props()
.onPress.toString()
)
wrapper
.find(MyChildComponent)
.first()
.props()
.onPress()
wrapper.update()
expect(wrapper.state()).toEqual({ name: '::any name::' })
}) Output:
|
ahhh this is because enzyme does not yet support components that return non-nodes - ie, an array. If you wrap the See #1149; closing this one in favor of that. |
Describe the bug
Test fails with strange setState error when multiple childs are rendered and callback is passed to each of them. The strange thing is that setState is called from the production code.
To Reproduce
Expected behavior
Test to pass
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: