import React from 'react'; import { mount } from 'enzyme'; import ConfigProvider from '..'; import DatePicker from '../../date-picker'; import Slider from '../../slider'; import Drawer from '../../drawer'; describe('ConfigProvider.GetPopupContainer', () => { it('Datepicker', () => { const getPopupContainer = jest.fn(node => node.parentNode); mount( , ); expect(getPopupContainer).toHaveBeenCalled(); }); it('Slider', () => { const getPopupContainer = jest.fn(node => node.parentNode); const wrapper = mount( , ); wrapper.find('.ant-slider-handle').first().simulate('mouseenter'); expect(getPopupContainer).toHaveBeenCalled(); }); it('drawer', () => { const getPopupContainer = jest.fn(node => node.parentNode); const Demo = ({ visible }) => ( ); mount(); expect(getPopupContainer).toHaveBeenCalled(); }); });