feat(Switch): add click event (#4915)

This commit is contained in:
neverland
2019-11-04 17:58:20 +08:00
committed by GitHub
parent a19d3cc5c0
commit 577174c7f8
5 changed files with 62 additions and 77 deletions
+15
View File
@@ -82,3 +82,18 @@ test('size prop', () => {
expect(wrapper).toMatchSnapshot();
});
test('click event', () => {
const click = jest.fn();
const wrapper = mount(Switch, {
context: {
on: {
click
}
}
});
wrapper.trigger('click');
expect(click).toHaveBeenCalledTimes(1);
});