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