2017-08-24 12:56:25 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { shallow } from 'enzyme';
|
|
|
|
import Checkbox from '..';
|
2017-11-19 01:41:40 +08:00
|
|
|
import focusTest from '../../../tests/shared/focusTest';
|
2017-08-24 12:56:25 +08:00
|
|
|
|
|
|
|
describe('Checkbox', () => {
|
2017-11-19 01:41:40 +08:00
|
|
|
focusTest(Checkbox);
|
|
|
|
|
2017-08-24 12:56:25 +08:00
|
|
|
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();
|
|
|
|
});
|
|
|
|
});
|