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', () => {
assert.notCalled(fakeStore.addToastMessage);
});
[
{ autoDismiss: undefined, expectedAutoDismiss: true },
{ autoDismiss: true, expectedAutoDismiss: true },
{ autoDismiss: false, expectedAutoDismiss: false },
].forEach(({ autoDismiss, expectedAutoDismiss }) => {
it('adds a new error toast message to the store', () => {
fakeStore.hasToastMessage.returns(false);
service.error('boo');
service.error('boo', { autoDismiss });
assert.calledWith(
fakeStore.addToastMessage,
sinon.match({ type: 'error', message: 'boo' }),
sinon.match({
type: 'error',
message: 'boo',
autoDismiss: expectedAutoDismiss,
}),
);
});
it('does not dismiss the message if `autoDismiss` is false', () => {
fakeStore.hasToastMessage.returns(false);
fakeStore.getToastMessage.returns(undefined);
service.error('boo', { autoDismiss: false });
assert.notCalled(fakeStore.getToastMessage);
assert.notCalled(fakeStore.removeToastMessage);
});
});
......
......@@ -114,6 +114,7 @@ export class ToastMessengerService extends TinyEmitter {
id,
message: messageText,
visuallyHidden,
autoDismiss,
};
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