ant-design/components/checkbox/__tests__/checkbox.test.js
Wei Zhu 9678d3fcfd
Focus && blur support (#8204)
* Add test for select

* Add focus() and blur() for AutoComplete

* Add focus() and blur() to Cascader

* Add focus test for input

* Add focus() and blur() for Checkbox

* Add focus() and blur() for Radio

* Add focus() and blur() for Switch

* Add blur() for TimePicker

* Add focus() and blur() to TreeSelect
2017-11-19 01:41:40 +08:00

27 lines
618 B
JavaScript

import React from 'react';
import { shallow } from 'enzyme';
import Checkbox from '..';
import focusTest from '../../../tests/shared/focusTest';
describe('Checkbox', () => {
focusTest(Checkbox);
it('responses hover events', () => {
const onMouseEnter = jest.fn();
const onMouseLeave = jest.fn();
const wrapper = shallow(
<Checkbox
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
/>
);
wrapper.simulate('mouseenter');
expect(onMouseEnter).toHaveBeenCalled();
wrapper.simulate('mouseleave');
expect(onMouseLeave).toHaveBeenCalled();
});
});