diff --git a/components/modal/Modal.tsx b/components/modal/Modal.tsx index bc28b952c..1b3fbc02e 100644 --- a/components/modal/Modal.tsx +++ b/components/modal/Modal.tsx @@ -79,7 +79,7 @@ const modalProps = { wrapClassName: PropTypes.string, maskTransitionName: PropTypes.string, transitionName: PropTypes.string, - getContainer: PropTypes.func, + getContainer: PropTypes.any, zIndex: PropTypes.number, bodyStyle: PropTypes.style, maskStyle: PropTypes.style, @@ -119,7 +119,7 @@ export interface ModalFuncProps { maskStyle?: CSSProperties; type?: string; keyboard?: boolean; - getContainer?: getContainerFunc; + getContainer?: getContainerFunc | boolean | string; autoFocusButton?: null | 'ok' | 'cancel'; transitionName?: string; maskTransitionName?: string; diff --git a/components/modal/__tests__/Modal.test.js b/components/modal/__tests__/Modal.test.js index fb8a6bc7e..f9f7adca3 100644 --- a/components/modal/__tests__/Modal.test.js +++ b/components/modal/__tests__/Modal.test.js @@ -65,4 +65,17 @@ describe('Modal', () => { expect(wrapper.html()).toMatchSnapshot(); }); }); + + it('should work with getContainer=false', async () => { + const wrapper1 = mount(Modal, { + sync: false, + props: { + getContainer: false, + visible: true, + }, + }); + await asyncExpect(() => { + expect(wrapper1.html()).toMatchSnapshot(); + }); + }); }); diff --git a/components/modal/__tests__/__snapshots__/Modal.test.js.snap b/components/modal/__tests__/__snapshots__/Modal.test.js.snap index 1d3bc0ccc..ede42e3f3 100644 --- a/components/modal/__tests__/__snapshots__/Modal.test.js.snap +++ b/components/modal/__tests__/__snapshots__/Modal.test.js.snap @@ -86,3 +86,26 @@ exports[`Modal render without footer 1`] = ` `; + +exports[`Modal should work with getContainer=false 1`] = ` +