From f3c38d5811dc7fdb3e25fbb745ccf4903a0aee38 Mon Sep 17 00:00:00 2001 From: Rex Date: Wed, 17 May 2017 10:24:16 +0800 Subject: [PATCH] fix: `notification.destroy` bug (#6161) --- components/notification/__tests__/index.test.js | 7 +++++++ components/notification/index.tsx | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/components/notification/__tests__/index.test.js b/components/notification/__tests__/index.test.js index a052cd34cc..322b57c296 100644 --- a/components/notification/__tests__/index.test.js +++ b/components/notification/__tests__/index.test.js @@ -43,6 +43,13 @@ describe('notification', () => { expect(document.querySelectorAll('.ant-notification-notice').length).toBe(0); }); + it('should be able to destroy after config', () => { + notification.config({ + bottom: 100, + }); + notification.destroy(); + }); + it('should be able to open with icon', () => { const openNotificationWithIcon = (type) => { const iconPrefix = '.ant-notification-notice-icon'; diff --git a/components/notification/index.tsx b/components/notification/index.tsx index 4cde43fab2..ded1d41c78 100755 --- a/components/notification/index.tsx +++ b/components/notification/index.tsx @@ -188,7 +188,7 @@ const api: { if (notify) { notify.destroy(); } - notificationInstance[defaultPlacement] = null; + delete notificationInstance[defaultPlacement]; } if (duration !== undefined) { defaultDuration = duration;