mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 05:05:48 +08:00
272ff9885a
* fix: Cascader deps * docs: Update using new API * test: Test case cover * chore: compressed skip dup check
48 lines
1.5 KiB
JavaScript
48 lines
1.5 KiB
JavaScript
import React from 'react';
|
|
import { mount } from 'enzyme';
|
|
import ConfigProvider from '..';
|
|
import DatePicker from '../../date-picker';
|
|
import Slider from '../../slider';
|
|
import Drawer from '../../drawer';
|
|
import Cascader from '../../cascader';
|
|
|
|
describe('ConfigProvider.GetPopupContainer', () => {
|
|
it('Datepicker', () => {
|
|
const getPopupContainer = jest.fn(node => node.parentNode);
|
|
mount(
|
|
<ConfigProvider getPopupContainer={getPopupContainer}>
|
|
<DatePicker open />
|
|
</ConfigProvider>,
|
|
);
|
|
expect(getPopupContainer).toHaveBeenCalled();
|
|
});
|
|
|
|
it('Slider', () => {
|
|
const getPopupContainer = jest.fn(node => node.parentNode);
|
|
const wrapper = mount(
|
|
<ConfigProvider getPopupContainer={getPopupContainer}>
|
|
<Slider />
|
|
</ConfigProvider>,
|
|
);
|
|
wrapper.find('.ant-slider-handle').first().simulate('mouseenter');
|
|
expect(getPopupContainer).toHaveBeenCalled();
|
|
});
|
|
|
|
it('Drawer', () => {
|
|
const getPopupContainer = jest.fn(node => node.parentNode);
|
|
const Demo = ({ visible }) => (
|
|
<ConfigProvider getPopupContainer={getPopupContainer}>
|
|
<Drawer visible={visible} />
|
|
</ConfigProvider>
|
|
);
|
|
mount(<Demo visible />);
|
|
expect(getPopupContainer).toHaveBeenCalled();
|
|
});
|
|
|
|
it('Cascader', () => {
|
|
const getPopupContainer = jest.fn(node => node.parentNode);
|
|
mount(<Cascader getPopupContainer={getPopupContainer} open />);
|
|
expect(getPopupContainer).toHaveBeenCalled();
|
|
});
|
|
});
|