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
f00c6db8
Commit
f00c6db8
authored
Jan 26, 2019
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new spec for updateStoreState method
parent
4e40d72a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
7 deletions
+21
-7
app/assets/javascripts/issue_show/components/app.vue
app/assets/javascripts/issue_show/components/app.vue
+3
-7
spec/javascripts/issue_show/components/app_spec.js
spec/javascripts/issue_show/components/app_spec.js
+18
-0
No files found.
app/assets/javascripts/issue_show/components/app.vue
View file @
f00c6db8
...
...
@@ -212,9 +212,8 @@ export default {
}
return
undefined
;
},
updateStoreState
()
{
this
.
service
return
this
.
service
.
getData
()
.
then
(
res
=>
res
.
data
)
.
then
(
data
=>
{
...
...
@@ -252,12 +251,9 @@ export default {
if
(
window
.
location
.
pathname
!==
data
.
web_url
)
{
visitUrl
(
data
.
web_url
);
}
return
this
.
service
.
getData
();
})
.
then
(
res
=>
res
.
data
)
.
then
(
data
=>
{
this
.
store
.
updateState
(
data
);
.
then
(
this
.
updateStoreState
)
.
then
(()
=>
{
eventHub
.
$emit
(
'
close.form
'
);
})
.
catch
(
error
=>
{
...
...
spec/javascripts/issue_show/components/app_spec.js
View file @
f00c6db8
...
...
@@ -140,6 +140,7 @@ describe('Issuable output', () => {
describe
(
'
updateIssuable
'
,
()
=>
{
it
(
'
fetches new data after update
'
,
done
=>
{
spyOn
(
vm
,
'
updateStoreState
'
).
and
.
callThrough
();
spyOn
(
vm
.
service
,
'
getData
'
).
and
.
callThrough
();
spyOn
(
vm
.
service
,
'
updateIssuable
'
).
and
.
callFake
(
()
=>
...
...
@@ -155,6 +156,7 @@ describe('Issuable output', () => {
vm
.
updateIssuable
()
.
then
(()
=>
{
expect
(
vm
.
updateStoreState
).
toHaveBeenCalled
();
expect
(
vm
.
service
.
getData
).
toHaveBeenCalled
();
})
.
then
(
done
)
...
...
@@ -452,4 +454,20 @@ describe('Issuable output', () => {
expect
(
vm
.
$el
.
querySelector
(
'
.title-container .note-action-button
'
)).
toBeDefined
();
});
});
describe
(
'
updateStoreState
'
,
()
=>
{
it
(
'
should make a request and update the state of the store
'
,
done
=>
{
const
data
=
{
foo
:
1
};
spyOn
(
vm
.
store
,
'
updateState
'
);
spyOn
(
vm
.
service
,
'
getData
'
).
and
.
returnValue
(
Promise
.
resolve
({
data
}));
vm
.
updateStoreState
()
.
then
(()
=>
{
expect
(
vm
.
service
.
getData
).
toHaveBeenCalled
();
expect
(
vm
.
store
.
updateState
).
toHaveBeenCalledWith
(
data
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
});
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