diff --git a/components/tooltip/__tests__/tooltip.test.js b/components/tooltip/__tests__/tooltip.test.js index ae7ab7b624..58590e5a48 100644 --- a/components/tooltip/__tests__/tooltip.test.js +++ b/components/tooltip/__tests__/tooltip.test.js @@ -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( + + + + + + + ); + + 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); + }); });