Skip to content

Commit

Permalink
test(CustomFileInput): ensure onChange calls prop.onChange if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
David Ellingsworth authored and David Ellingsworth committed Apr 16, 2019
1 parent 76404cd commit ebbfc69
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/__tests__/CustomInput.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,16 @@ describe('Custom Inputs', () => {
expect(ref.current).not.toBeNull();
expect(ref.current).toBeInstanceOf(HTMLInputElement);
});

describe('onChange', () => {
it('calls props.onChange if it exists', () => {
const onChange = jest.fn();
const file = mount(<CustomInput type="file" onChange={onChange} />);

file.find('input').hostNodes().simulate('change');
expect(onChange).toHaveBeenCalled();
});
});
});

describe('CustomRange', () => {
Expand Down

0 comments on commit ebbfc69

Please sign in to comment.