These are chat archives for airbnb/enzyme

25th
Feb 2016
Janusch
@janusch
Feb 25 2016 14:52
Hello, I got a quick question, how do you simulate a input value change event and assert on the value, or assert onChange handler been called?
it('updates value on input change', function() {
    const changeSpy = sinon.spy();
    const wrapper = shallow(<Input value={'123'}
      handleChange={changeSpy} pos={1} />);
    wrapper.find('input[type=text]').simulate('change', '321');
    expect(changeSpy).called();
});
Jordan Harband
@ljharb
Feb 25 2016 16:45
currently you have to fire the change event and set the value manually
Blaine Kasten
@blainekasten
Feb 25 2016 17:00
@janusch, does the internals of Input have an onChange handle for input that calls the prop.handleChange?