Skip to content

Instantly share code, notes, and snippets.

@stelmakh
Created December 30, 2018 09:42
Show Gist options
  • Select an option

  • Save stelmakh/1a80a9a1d43287eac1b7a71074e97e8f to your computer and use it in GitHub Desktop.

Select an option

Save stelmakh/1a80a9a1d43287eac1b7a71074e97e8f to your computer and use it in GitHub Desktop.
it('has a disabled state', () => {
const value = 'hellotest'
const newValue = 'newvalue'
const onChange = jest.fn()
const component = shallow(
<Input
value={value}
onChange={onChange}
disabled
/>
);
const evt = { target: { value: newValue } }
component.find('input').simulate('change', evt)
expect(component.hasClass('disabled')).toBe(true)
expect(onChange).toBeCalledTimes(0)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment