How can I simulate a click on a rendered component?
import { shallow } from 'enzyme'
const props = { onClick: jest.fn() }
const wrapper = <App {...props} />
const domNode = document.querySelector('#root')
const component = shallow(wrapper, domNode)
const selector = '.btn-add'
const eventName = 'click'
component.find(selector).simulate(eventName)
PreviousHow can I set and get state in my component?NextHow can I simulate a change to an input field?
Last updated
Was this helpful?