mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-24 02:20:01 +08:00
fix: notification should hide close icon when closeIcon={null} (#42791)
This commit is contained in:
parent
90ad14ef2d
commit
93a6ee1b40
@ -272,6 +272,30 @@ describe('notification', () => {
|
||||
expect(document.querySelectorAll('.test-customize-icon').length).toBe(1);
|
||||
});
|
||||
|
||||
it('support closeIcon to be null', () => {
|
||||
act(() => {
|
||||
notification.open({
|
||||
message: 'Notification Title',
|
||||
duration: 0,
|
||||
closeIcon: null,
|
||||
});
|
||||
});
|
||||
|
||||
expect(document.querySelectorAll('.test-customize-icon').length).toBe(0);
|
||||
});
|
||||
|
||||
it('support closeIcon to be false', () => {
|
||||
act(() => {
|
||||
notification.open({
|
||||
message: 'Notification Title',
|
||||
duration: 0,
|
||||
closeIcon: false,
|
||||
});
|
||||
});
|
||||
|
||||
expect(document.querySelectorAll('.test-customize-icon').length).toBe(0);
|
||||
});
|
||||
|
||||
it('support config closeIcon', () => {
|
||||
notification.config({
|
||||
closeIcon: <span className="test-customize-icon" />,
|
||||
|
@ -252,10 +252,13 @@ function getRCNoticeProps(args: ArgsProps, prefixCls: string, iconPrefixCls?: st
|
||||
});
|
||||
}
|
||||
|
||||
const closeIconToRender = (
|
||||
const closeIconToRender =
|
||||
typeof closeIcon === 'undefined' ? (
|
||||
<span className={`${prefixCls}-close-x`}>
|
||||
{closeIcon || <CloseOutlined className={`${prefixCls}-close-icon`} />}
|
||||
<CloseOutlined className={`${prefixCls}-close-icon`} />
|
||||
</span>
|
||||
) : (
|
||||
closeIcon
|
||||
);
|
||||
|
||||
const autoMarginTag =
|
||||
|
Loading…
Reference in New Issue
Block a user