ant-design-vue/components/checkbox/__tests__/checkbox.test.js

25 lines
604 B
JavaScript
Raw Normal View History

2019-01-12 03:33:27 +00:00
import { mount } from '@vue/test-utils';
import Checkbox from '..';
import focusTest from '../../../tests/shared/focusTest';
2018-05-20 13:42:23 +00:00
describe('Checkbox', () => {
2019-01-12 03:33:27 +00:00
focusTest(Checkbox);
2018-05-20 13:42:23 +00:00
it('responses hover events', () => {
2019-01-12 03:33:27 +00:00
const onMouseEnter = jest.fn();
const onMouseLeave = jest.fn();
2018-05-20 13:42:23 +00:00
const wrapper = mount(Checkbox, {
listeners: {
mouseenter: onMouseEnter,
mouseleave: onMouseLeave,
},
2019-01-12 03:33:27 +00:00
});
2018-05-20 13:42:23 +00:00
2019-01-12 03:33:27 +00:00
wrapper.trigger('mouseenter');
expect(onMouseEnter).toHaveBeenCalled();
2018-05-20 13:42:23 +00:00
2019-01-12 03:33:27 +00:00
wrapper.trigger('mouseleave');
expect(onMouseLeave).toHaveBeenCalled();
});
});