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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
45b2c63f
Commit
45b2c63f
authored
Mar 22, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplifies assignment of default options
parent
269adbf9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
app/assets/javascripts/lib/utils/poll.js
app/assets/javascripts/lib/utils/poll.js
+2
-3
spec/javascripts/lib/utils/poll_spec.js
spec/javascripts/lib/utils/poll_spec.js
+2
-0
No files found.
app/assets/javascripts/lib/utils/poll.js
View file @
45b2c63f
...
@@ -32,9 +32,8 @@ import httpStatusCodes from './http_status';
...
@@ -32,9 +32,8 @@ import httpStatusCodes from './http_status';
*/
*/
export
default
class
Poll
{
export
default
class
Poll
{
constructor
(
options
=
{})
{
constructor
(
options
=
{})
{
this
.
options
=
Object
.
assign
({},
{
this
.
options
=
options
;
data
:
{},
this
.
options
.
data
=
options
.
data
||
{};
},
options
);
this
.
intervalHeader
=
'
POLL-INTERVAL
'
;
this
.
intervalHeader
=
'
POLL-INTERVAL
'
;
}
}
...
...
spec/javascripts/lib/utils/poll_spec.js
View file @
45b2c63f
...
@@ -109,12 +109,14 @@ describe('Poll', () => {
...
@@ -109,12 +109,14 @@ describe('Poll', () => {
new
Poll
({
new
Poll
({
resource
:
service
,
resource
:
service
,
method
:
'
fetch
'
,
method
:
'
fetch
'
,
data
:
{
page
:
1
},
successCallback
:
callbacks
.
success
,
successCallback
:
callbacks
.
success
,
errorCallback
:
callbacks
.
error
,
errorCallback
:
callbacks
.
error
,
}).
makeRequest
();
}).
makeRequest
();
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
service
.
fetch
.
calls
.
count
()).
toEqual
(
2
);
expect
(
service
.
fetch
.
calls
.
count
()).
toEqual
(
2
);
expect
(
service
.
fetch
).
toHaveBeenCalledWith
({
page
:
1
});
expect
(
callbacks
.
success
).
toHaveBeenCalled
();
expect
(
callbacks
.
success
).
toHaveBeenCalled
();
expect
(
callbacks
.
error
).
not
.
toHaveBeenCalled
();
expect
(
callbacks
.
error
).
not
.
toHaveBeenCalled
();
done
();
done
();
...
...
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