mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 07:56:28 +08:00
parent
cb24060955
commit
faa5eaef12
@ -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(
|
||||
<Popconfirm title="code" defaultVisible>
|
||||
<span>show me your code</span>
|
||||
</Popconfirm>
|
||||
);
|
||||
expect(popconfirm.instance().getPopupDomNode()).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
@ -42,6 +42,8 @@ class Popconfirm extends React.Component<PopconfirmProps, PopconfirmState> {
|
||||
static getDerivedStateFromProps(nextProps: PopconfirmProps) {
|
||||
if ('visible' in nextProps) {
|
||||
return { visible: nextProps.visible };
|
||||
} else if ('defaultVisible' in nextProps) {
|
||||
return { visible: nextProps.defaultVisible };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user