|
|
|
@ -3,6 +3,8 @@ import { mount } from 'enzyme';
|
|
|
|
|
import Tooltip from '..';
|
|
|
|
|
import Button from '../../button';
|
|
|
|
|
import DatePicker from '../../date-picker';
|
|
|
|
|
import Input from '../../input';
|
|
|
|
|
import Group from '../../input/Group';
|
|
|
|
|
|
|
|
|
|
const delay = timeout => new Promise(resolve => setTimeout(resolve, timeout));
|
|
|
|
|
|
|
|
|
@ -202,4 +204,32 @@ describe('Tooltip', () => {
|
|
|
|
|
expect(onVisibleChange).toBeCalledWith(false);
|
|
|
|
|
expect(wrapper.instance().tooltip.props.visible).toBe(false);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should works for input group', async () => {
|
|
|
|
|
const onVisibleChange = jest.fn();
|
|
|
|
|
|
|
|
|
|
const wrapper = mount(
|
|
|
|
|
<Tooltip
|
|
|
|
|
title="hello"
|
|
|
|
|
onVisibleChange={onVisibleChange}
|
|
|
|
|
>
|
|
|
|
|
<Group>
|
|
|
|
|
<Input style={{ width: '50%' }} />
|
|
|
|
|
<Input style={{ width: '50%' }} />
|
|
|
|
|
</Group>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
expect(wrapper.find('Group')).toHaveLength(1);
|
|
|
|
|
const picker = wrapper.find('Group').at(0);
|
|
|
|
|
picker.simulate('mouseenter');
|
|
|
|
|
await delay(100);
|
|
|
|
|
expect(onVisibleChange).toBeCalledWith(true);
|
|
|
|
|
expect(wrapper.instance().tooltip.props.visible).toBe(true);
|
|
|
|
|
|
|
|
|
|
picker.simulate('mouseleave');
|
|
|
|
|
await delay(100);
|
|
|
|
|
expect(onVisibleChange).toBeCalledWith(false);
|
|
|
|
|
expect(wrapper.instance().tooltip.props.visible).toBe(false);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|