-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fix CheckboxGroup tests to use process.nextTick() #721
Conversation
expect(component.state().value).to.eql({ terminator: false, predator: true, soundofmusic: false }); | ||
process.nextTick(() => { | ||
expect(component.state().value).to.eql({ terminator: false, predator: true, soundofmusic: false }); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to pass in done()
to ensure that the test will finish after nextTick()
is executed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good pickup man
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I do that, the test fails... go figure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting.
@@ -64,7 +65,9 @@ describe('CheckboxGroup', () => { | |||
); | |||
const firstChild = component.find('Checkbox').at(0); | |||
firstChild.simulate('change', event); | |||
expect(component.state().value).to.eql({ terminator: true, predator: false, soundofmusic: false }); | |||
process.nextTick(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this is a good retro learned to add and talk about
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, once we're sure what we've learned... so far it's all very weird. Multiple discussions on github but no resolution that works, at least, not for our use case:
- Component State doesn't update on simulating input change event enzymejs/enzyme#1283
- How to : Simulate the click event of child component in parent component enzymejs/enzyme#382
- Listening to renders enzymejs/enzyme#728
- mount/shallow does not rerender when props change or apply new props on update enzymejs/enzyme#1229
- simulate('click') on child component does not propagate to trigger blur on parent enzymejs/enzyme#1551
Closing this PR as none of us had any luck finding out what the problem was. It was decided to drop node v6 support instead, see #722. |
Fix CheckboxGroup tests to use process.nextTick() to ensure that state is updated.
Description
Motivation and Background Context
For some reason, the tests were passing on node v8, failing on node 6.14.2.
Does this PR introduce a breaking change?
How Has This Been Tested?
Screenshots (if appropriate):
Check-list: