[new feature] Toast: add onClose prop (#2964)

This commit is contained in:
neverland
2019-03-13 20:16:39 +08:00
committed by GitHub
parent a4eedac8b1
commit 2e7ca412ff
5 changed files with 26 additions and 5 deletions

View File

@@ -73,3 +73,16 @@ test('toast duration 0', () => {
expect(toast.timer).toBeFalsy();
Toast.allowMultiple(false);
});
test('onClose callback', () => {
Toast.allowMultiple();
const onClose = jest.fn();
const toast = Toast({
message: 'toast',
onClose
});
toast.clear();
Toast.allowMultiple(false);
expect(onClose.mock.calls.length).toEqual(1);
});