[bugfix] Toast: missing fade-out transition in multiple mode (#3504)

This commit is contained in:
neverland
2019-06-14 11:51:08 +08:00
committed by GitHub
parent 769de91a6e
commit 0ea1c6f644
3 changed files with 34 additions and 9 deletions
+16 -1
View File
@@ -75,7 +75,7 @@ test('clear toast', () => {
Toast.allowMultiple(false);
});
test('multiple toast', () => {
test('clear multiple toast', () => {
Toast.allowMultiple();
Toast.clear(true);
const toast1 = Toast.success('1');
@@ -89,6 +89,21 @@ test('multiple toast', () => {
Toast.allowMultiple(false);
});
test('remove toast DOM when cleared in multiple mode', async () => {
Toast.allowMultiple();
Toast.clear(true);
const toast = Toast({ message: '1' });
await later();
// mock onAfterLeave
toast.clear();
toast.onAfterLeave();
await later();
expect(toast.$el.parentNode).toEqual(null);
Toast.allowMultiple(false);
});
test('set default options', () => {
Toast.setDefaultOptions({ duration: 1000 });
expect(Toast().duration).toEqual(1000);