Commit 33cb5da1 authored by Alejandro Celaya's avatar Alejandro Celaya Committed by Alejandro Celaya

Fix autoDismiss option ignored in toast messages

parent 0b1d00e0
...@@ -91,25 +91,25 @@ describe('ToastMessengerService', () => { ...@@ -91,25 +91,25 @@ describe('ToastMessengerService', () => {
assert.notCalled(fakeStore.addToastMessage); assert.notCalled(fakeStore.addToastMessage);
}); });
it('adds a new error toast message to the store', () => { [
fakeStore.hasToastMessage.returns(false); { autoDismiss: undefined, expectedAutoDismiss: true },
{ autoDismiss: true, expectedAutoDismiss: true },
service.error('boo'); { autoDismiss: false, expectedAutoDismiss: false },
].forEach(({ autoDismiss, expectedAutoDismiss }) => {
assert.calledWith( it('adds a new error toast message to the store', () => {
fakeStore.addToastMessage, fakeStore.hasToastMessage.returns(false);
sinon.match({ type: 'error', message: 'boo' }),
); service.error('boo', { autoDismiss });
});
assert.calledWith(
it('does not dismiss the message if `autoDismiss` is false', () => { fakeStore.addToastMessage,
fakeStore.hasToastMessage.returns(false); sinon.match({
fakeStore.getToastMessage.returns(undefined); type: 'error',
message: 'boo',
service.error('boo', { autoDismiss: false }); autoDismiss: expectedAutoDismiss,
}),
assert.notCalled(fakeStore.getToastMessage); );
assert.notCalled(fakeStore.removeToastMessage); });
}); });
}); });
......
...@@ -114,6 +114,7 @@ export class ToastMessengerService extends TinyEmitter { ...@@ -114,6 +114,7 @@ export class ToastMessengerService extends TinyEmitter {
id, id,
message: messageText, message: messageText,
visuallyHidden, visuallyHidden,
autoDismiss,
}; };
this._store.addToastMessage(message); this._store.addToastMessage(message);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment