mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
fix(popover): support defaultOpen (#48481)
* fix(popover): support defaultOpen * chore: add test * fix: remove test code * fix: open use default value * chore: Coding style * chore: devtool add warning * fix: remove warning * fix: Remove unused dependencies --------- Co-authored-by: linhf123 <wb-lhf780012@antgroup.com> Co-authored-by: afc163 <afc163@gmail.com>
This commit is contained in:
parent
4b2a94e383
commit
a512f81222
@ -28,6 +28,15 @@ describe('Popover', () => {
|
||||
expect(container.querySelector('.ant-popover-inner-content')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should support defaultOpen', () => {
|
||||
const { container } = render(
|
||||
<Popover title="code" defaultOpen>
|
||||
<span>show me your code</span>
|
||||
</Popover>,
|
||||
);
|
||||
expect(container.querySelector('.ant-popover')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('shows content for render functions', () => {
|
||||
const renderTitle = () => 'some-title';
|
||||
const renderContent = () => 'some-content';
|
||||
|
@ -60,6 +60,7 @@ const InternalPopover = React.forwardRef<TooltipRef, PopoverProps>((props, ref)
|
||||
const overlayCls = classNames(overlayClassName, hashId, cssVarCls);
|
||||
const [open, setOpen] = useMergedState(false, {
|
||||
value: props.open ?? props.visible,
|
||||
defaultValue: props.defaultOpen ?? props.defaultVisible,
|
||||
});
|
||||
|
||||
const settingOpen = (
|
||||
|
Loading…
Reference in New Issue
Block a user