Skip to content

Instantly share code, notes, and snippets.

@hellosweta
Created March 19, 2019 18:47
Show Gist options
  • Save hellosweta/af54c938d27383761ceff5119d903994 to your computer and use it in GitHub Desktop.
Save hellosweta/af54c938d27383761ceff5119d903994 to your computer and use it in GitHub Desktop.
Simulating input changes in Enzyme and Formik
const checkbox = form.find('input[name="agreementAccepted"]');
checkbox.simulate('change', {
persist: () => {},
target: {
checked: true, name: 'agreementAccepted'
}
});
const contactNameInput = form.find('input[name="contactName"]');
nameInput.simulate('change', { target: { value: '', name: 'name' } });
const dropdown = form.find('input[name="product"]')
const showInfoCheckbox = form.find('input[name="shareInformation"]');
showInfoCheckbox.simulate('click');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment