Enzyme simulate an onChange event
You can simply spy to the method directly via the prototype. it(“responds to name change”, done => { const handleChangeSpy = sinon.spy(New.prototype, “handleChange”); const event = {target: {name: “pollName”, value: “spam”}}; const wrap = mount( <New /> ); wrap.ref(‘pollName’).simulate(‘change’, event); expect(handleChangeSpy.calledOnce).to.equal(true); }) Alternatively, you can use spy on the instance’s method, but you have to … Read more