mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
fix: Popconfirm text missing (#46812)
This commit is contained in:
parent
15324982ab
commit
8f6f8de9b3
@ -73,7 +73,7 @@ export const Overlay: React.FC<OverlayProps> = (props) => {
|
||||
<div className={`${prefixCls}-buttons`}>
|
||||
{showCancel && (
|
||||
<Button onClick={onCancel} size="small" {...cancelButtonProps}>
|
||||
{cancelText ?? contextLocale?.cancelText}
|
||||
{cancelText || contextLocale?.cancelText}
|
||||
</Button>
|
||||
)}
|
||||
<ActionButton
|
||||
@ -88,7 +88,7 @@ export const Overlay: React.FC<OverlayProps> = (props) => {
|
||||
quitOnNullishReturnValue
|
||||
emitEvent
|
||||
>
|
||||
{okText ?? contextLocale?.okText}
|
||||
{okText || contextLocale?.okText}
|
||||
</ActionButton>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { spyElementPrototype } from 'rc-util/lib/test/domHook';
|
||||
import React from 'react';
|
||||
import { spyElementPrototype } from 'rc-util/lib/test/domHook';
|
||||
|
||||
import Popconfirm from '..';
|
||||
import mountTest from '../../../tests/shared/mountTest';
|
||||
import rtlTest from '../../../tests/shared/rtlTest';
|
||||
@ -354,4 +355,15 @@ describe('Popconfirm', () => {
|
||||
expect(onOpenChange).toHaveBeenCalledTimes(1);
|
||||
expect(onVisibleChange).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('okText & cancelText could be empty', () => {
|
||||
render(
|
||||
<Popconfirm title="" okText="" cancelText="" open>
|
||||
<span />
|
||||
</Popconfirm>,
|
||||
);
|
||||
|
||||
expect(document.body.querySelectorAll('.ant-btn')[0].textContent).toBe('Cancel');
|
||||
expect(document.body.querySelectorAll('.ant-btn')[1].textContent).toBe('OK');
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user