diff --git a/components/notification/__tests__/index.test.tsx b/components/notification/__tests__/index.test.tsx index c62bed90ad..d7ff8fea09 100644 --- a/components/notification/__tests__/index.test.tsx +++ b/components/notification/__tests__/index.test.tsx @@ -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: , diff --git a/components/notification/index.tsx b/components/notification/index.tsx index c674a97827..d3d6bb90e5 100755 --- a/components/notification/index.tsx +++ b/components/notification/index.tsx @@ -252,11 +252,14 @@ function getRCNoticeProps(args: ArgsProps, prefixCls: string, iconPrefixCls?: st }); } - const closeIconToRender = ( - - {closeIcon || } - - ); + const closeIconToRender = + typeof closeIcon === 'undefined' ? ( + + + + ) : ( + closeIcon + ); const autoMarginTag = !description && iconNode ? (