diff --git a/components/popconfirm/__tests__/index.test.js b/components/popconfirm/__tests__/index.test.js index 929c6d3e32..1a2b44f88b 100644 --- a/components/popconfirm/__tests__/index.test.js +++ b/components/popconfirm/__tests__/index.test.js @@ -117,4 +117,13 @@ describe('Popconfirm', () => { expect(wrapper.find('.custom-popconfirm').length).toBeGreaterThan(0); expect(wrapper.find('.custom-btn').length).toBeGreaterThan(0); }); + + it('should support defaultVisible', () => { + const popconfirm = mount( + + show me your code + + ); + expect(popconfirm.instance().getPopupDomNode()).toBeTruthy(); + }); }); diff --git a/components/popconfirm/index.tsx b/components/popconfirm/index.tsx index d93c111112..fc290097cc 100644 --- a/components/popconfirm/index.tsx +++ b/components/popconfirm/index.tsx @@ -42,6 +42,8 @@ class Popconfirm extends React.Component { static getDerivedStateFromProps(nextProps: PopconfirmProps) { if ('visible' in nextProps) { return { visible: nextProps.visible }; + } else if ('defaultVisible' in nextProps) { + return { visible: nextProps.defaultVisible }; } return null; }