Refactor toast module (#26677)

1. Do not use "async"
2. Call `hideToast` instead of `removeElement` for manual closing
This commit is contained in:
wxiaoguang 2023-08-23 15:25:13 +08:00 committed by GitHub
parent e4b2bdfbc0
commit a428591f6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 20 deletions

View file

@ -2,16 +2,16 @@ import {test, expect} from 'vitest';
import {showInfoToast, showErrorToast, showWarningToast} from './toast.js';
test('showInfoToast', async () => {
await showInfoToast('success 😀', {duration: -1});
showInfoToast('success 😀', {duration: -1});
expect(document.querySelector('.toastify')).toBeTruthy();
});
test('showWarningToast', async () => {
await showWarningToast('warning 😐', {duration: -1});
showWarningToast('warning 😐', {duration: -1});
expect(document.querySelector('.toastify')).toBeTruthy();
});
test('showErrorToast', async () => {
await showErrorToast('error 🙁', {duration: -1});
showErrorToast('error 🙁', {duration: -1});
expect(document.querySelector('.toastify')).toBeTruthy();
});