Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
33cb5da1
Commit
33cb5da1
authored
Jan 19, 2024
by
Alejandro Celaya
Committed by
Alejandro Celaya
Jan 19, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix autoDismiss option ignored in toast messages
parent
0b1d00e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
19 deletions
+20
-19
toast-messenger-test.js
src/sidebar/services/test/toast-messenger-test.js
+19
-19
toast-messenger.ts
src/sidebar/services/toast-messenger.ts
+1
-0
No files found.
src/sidebar/services/test/toast-messenger-test.js
View file @
33cb5da1
...
...
@@ -91,25 +91,25 @@ describe('ToastMessengerService', () => {
assert
.
notCalled
(
fakeStore
.
addToastMessage
);
});
it
(
'adds a new error toast message to the store'
,
()
=>
{
fakeStore
.
hasToastMessage
.
returns
(
false
);
service
.
error
(
'boo'
);
assert
.
calledWith
(
fakeStore
.
addToastMessage
,
sinon
.
match
({
type
:
'error'
,
message
:
'boo'
}),
);
});
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
);
[
{
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'
,
{
autoDismiss
}
);
assert
.
calledWith
(
fakeStore
.
addToastMessage
,
sinon
.
match
({
type
:
'error'
,
message
:
'boo'
,
autoDismiss
:
expectedAutoDismiss
,
}),
);
}
);
});
});
...
...
src/sidebar/services/toast-messenger.ts
View file @
33cb5da1
...
...
@@ -114,6 +114,7 @@ export class ToastMessengerService extends TinyEmitter {
id
,
message
:
messageText
,
visuallyHidden
,
autoDismiss
,
};
this
.
_store
.
addToastMessage
(
message
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment