Merge branch '2.x' into dev

This commit is contained in:
chenjiahan
2020-11-04 20:06:59 +08:00
18 changed files with 88 additions and 16 deletions
+5 -1
View File
@@ -150,7 +150,7 @@ test('toast duration 0', () => {
Toast.allowMultiple(false);
});
test('onClose callback', () => {
test('should trigger onClose callback after closed', () => {
Toast.allowMultiple();
const onClose = jest.fn();
const toast = Toast({
@@ -158,6 +158,10 @@ test('onClose callback', () => {
onClose,
});
toast.clear();
expect(onClose).toHaveBeenCalledTimes(1);
// onClose should only be called once
toast.clear();
expect(onClose).toHaveBeenCalledTimes(1);
Toast.allowMultiple(false);