This commit is contained in:
Tom Moor committed 2019-01-09 22:59:39 -08:00
1 parent 23b227c352
commit 6fb51eb7bb
2 files changed
+11 -11

No files matched your search

+1 -1
View File
@@ -15,7 +15,7 @@ class Toast extends React.Component<Props> {
timeout: TimeoutID;
static defaultProps = {
closeAfterMs: 30000,
closeAfterMs: 3000,
};
componentDidMount() {
+10 -10
View File
@@ -9,20 +9,20 @@ describe('UiStore', () => {
store = stores.ui;
});
test('#add should add errors', () => {
expect(store.toasts.length).toBe(0);
test('#add should add messages', () => {
expect(store.orderedToasts.length).toBe(0);
store.showToast('first error');
store.showToast('second error');
expect(store.toasts.length).toBe(2);
expect(store.orderedToasts.length).toBe(2);
});
test('#remove should remove errors', () => {
store.toasts = [];
store.showToast('first error');
test('#remove should remove messages', () => {
store.toasts.clear();
const id = store.showToast('first error');
store.showToast('second error');
expect(store.toasts.length).toBe(2);
store.removeToast(0);
expect(store.toasts.length).toBe(1);
expect(store.toasts[0].message).toBe('second error');
expect(store.orderedToasts.length).toBe(2);
store.removeToast(id);
expect(store.orderedToasts.length).toBe(1);
expect(store.orderedToasts[0].message).toBe('second error');
});
});