From 9e2126bad8b6d5e097405709abb28e3fdb79814a Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 21 Oct 2018 20:20:35 +0800 Subject: [PATCH] [bugfix] Toast: destroy instance in multiple mode (#1959) --- packages/toast/index.js | 5 +++++ packages/toast/test/index.spec.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/toast/index.js b/packages/toast/index.js index 9d19539ca..b8907ff74 100644 --- a/packages/toast/index.js +++ b/packages/toast/index.js @@ -49,6 +49,11 @@ function Toast(options = {}) { ...parseOptions(options), clear() { toast.value = false; + + if (!singleton && !isServer) { + document.body.removeChild(toast.$el); + toast.$destroy(); + } } }; diff --git a/packages/toast/test/index.spec.js b/packages/toast/test/index.spec.js index 63e96f41e..c54a57c1b 100644 --- a/packages/toast/test/index.spec.js +++ b/packages/toast/test/index.spec.js @@ -5,7 +5,8 @@ transitionStub(); test('create a forbidClick toast', async() => { const toast = Toast({ - forbidClick: true + forbidClick: true, + type: 'success' }); expect(toast.$el.outerHTML).toMatchSnapshot();