Created
November 7, 2018 18:16
-
-
Save kvendrik/aebc0e88e94e38e0d3a840689a2903e1 to your computer and use it in GitHub Desktop.
TextField tests - onChange() trigger
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
| import {trigger} from '@shopify/enzyme-utilities'; | |
| ... | |
| describe('onChange()', () => { | |
| it('triggers when the user types', () => { | |
| const onChangeSpy = jest.fn(); | |
| const event = {}; | |
| const textField = mount( | |
| <TextField {...mockProps} onChange={onChangeSpy} />, | |
| ); | |
| trigger(textField.find('input'), 'onChange', event); | |
| expect(onChangeSpy).toHaveBeenCalledTimes(1); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment