Last active
April 27, 2018 07:24
-
-
Save mknabe/19be7277a8612e4a9ef9e3334cca54c9 to your computer and use it in GitHub Desktop.
React testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Call a component method | |
https://github.com/airbnb/enzyme/issues/208#issuecomment-187313486 | |
*/ | |
const wrapper = shallow(<Button />); wrapper.instance().handleClick(); | |
/* | |
Re-render component after calling setState | |
https://github.com/airbnb/enzyme/issues/450#issuecomment-225075145 | |
*/ | |
expect(wrapper.update().find('#counter').text()).to.equal('1'); | |
/* | |
Pass props to event handler | |
https://github.com/airbnb/enzyme/issues/400 | |
*/ | |
wrapper.find('Select').simulate('change', { target: { value: 'text' }}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment