ant-design/components/radio/__tests__/radio.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

32 lines
778 B
JavaScript

import React from 'react';
import { shallow, render } from 'enzyme';
import Radio from '../radio';
import focusTest from '../../../tests/shared/focusTest';
describe('Radio', () => {
focusTest(Radio);
it('should render correctly', () => {
const wrapper = render(<Radio className="customized">Test</Radio>);
expect(wrapper).toMatchSnapshot();
});
it('responses hover events', () => {
const onMouseEnter = jest.fn();
const onMouseLeave = jest.fn();
const wrapper = shallow(
<Radio
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
/>
);
wrapper.simulate('mouseenter');
expect(onMouseEnter).toHaveBeenCalled();
wrapper.simulate('mouseleave');
expect(onMouseLeave).toHaveBeenCalled();
});
});