Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
062547ce
Commit
062547ce
authored
Sep 23, 2019
by
Paul Gascou-Vaillancourt
Committed by
Kushal Pandya
Sep 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use GitLab UI toast in global_toast
parent
9514d151
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
app/assets/javascripts/vue_shared/plugins/global_toast.js
app/assets/javascripts/vue_shared/plugins/global_toast.js
+2
-1
spec/frontend/vue_shared/plugins/global_toast_spec.js
spec/frontend/vue_shared/plugins/global_toast_spec.js
+5
-5
No files found.
app/assets/javascripts/vue_shared/plugins/global_toast.js
View file @
062547ce
...
...
@@ -2,7 +2,8 @@ import Vue from 'vue';
import
{
GlToast
}
from
'
@gitlab/ui
'
;
Vue
.
use
(
GlToast
);
const
instance
=
new
Vue
();
export
default
function
showGlobalToast
(...
args
)
{
return
Vue
.
toasted
.
show
(...
args
);
return
instance
.
$toast
.
show
(...
args
);
}
spec/frontend/vue_shared/plugins/global_toast_spec.js
View file @
062547ce
import
toast
from
'
~/vue_shared/plugins/global_toast
'
;
import
Vue
from
'
vue
'
;
import
toast
from
'
~/vue_shared/plugins/global_toast
'
;
describe
(
'
Global toast
'
,
()
=>
{
let
spyFunc
;
beforeEach
(()
=>
{
spyFunc
=
jest
.
spyOn
(
Vue
.
toasted
,
'
show
'
).
mockImplementation
(()
=>
{});
spyFunc
=
jest
.
spyOn
(
Vue
.
prototype
.
$toast
,
'
show
'
).
mockImplementation
(()
=>
{});
});
afterEach
(()
=>
{
spyFunc
.
mockRestore
();
});
it
(
'
should pass all args to Vue toasted
'
,
()
=>
{
it
(
"
should call GitLab UI's toast method
"
,
()
=>
{
const
arg1
=
'
TestMessage
'
;
const
arg2
=
{
className
:
'
foo
'
};
toast
(
arg1
,
arg2
);
expect
(
Vue
.
toasted
.
show
).
toHaveBeenCalledTimes
(
1
);
expect
(
Vue
.
toasted
.
show
).
toHaveBeenCalledWith
(
arg1
,
arg2
);
expect
(
Vue
.
prototype
.
$toast
.
show
).
toHaveBeenCalledTimes
(
1
);
expect
(
Vue
.
prototype
.
$toast
.
show
).
toHaveBeenCalledWith
(
arg1
,
arg2
);
});
});
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