Skip to content

Commit

Permalink
Add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Jun 5, 2019
1 parent d3ee5c0 commit eab457f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/index.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,22 @@ describe('rc-checkbox', () => {
mount(<Checkbox autoFocus onFocus={handleFocus} />, { attachTo: container });
expect(handleFocus).toBeCalled();
});

it('onChange', () => {
const container = document.createElement('div');
document.body.appendChild(container);
const onChange = jest.fn();
const wrapper = mount(<Checkbox onChange={onChange} />, { attachTo: container });
wrapper.find('input').simulate('change');
expect(onChange).toBeCalled();
});

it('onChange disabled', () => {
const container = document.createElement('div');
document.body.appendChild(container);
const onChange = jest.fn();
const wrapper = mount(<Checkbox onChange={onChange} disabled />, { attachTo: container });
wrapper.find('input').simulate('change');
expect(onChange).not.toBeCalled();
});
});

0 comments on commit eab457f

Please sign in to comment.