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
Tatuya Kamada
gitlab-ce
Commits
96c7bd03
Commit
96c7bd03
authored
Mar 17, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix wait_for_vue_resource to not rely on global Vue object
parent
632497bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
app/assets/javascripts/vue_shared/vue_resource_interceptor.js
...assets/javascripts/vue_shared/vue_resource_interceptor.js
+7
-4
spec/support/wait_for_vue_resource.rb
spec/support/wait_for_vue_resource.rb
+1
-1
No files found.
app/assets/javascripts/vue_shared/vue_resource_interceptor.js
View file @
96c7bd03
/* eslint-disable no-param-reassign, no-plusplus */
import
Vue
from
'
vue
'
;
import
VueResource
from
'
vue-resource
'
;
Vue
.
use
(
VueResource
);
// Maintain a global counter for active requests
// see: spec/support/wait_for_vue_resource.rb
Vue
.
http
.
interceptors
.
push
((
request
,
next
)
=>
{
Vue
.
activeResources
=
Vue
.
activeResources
?
Vue
.
activeResources
+
1
:
1
;
window
.
activeVueResources
=
window
.
activeVueResources
||
0
;
window
.
activeVueResources
+=
1
;
next
(()
=>
{
Vue
.
activeResources
--
;
window
.
activeVueResources
-=
1
;
});
});
// Inject CSRF token so we don't break any tests.
Vue
.
http
.
interceptors
.
push
((
request
,
next
)
=>
{
// needed in order to not break the tests.
if
(
$
.
rails
)
{
// eslint-disable-next-line no-param-reassign
request
.
headers
[
'
X-CSRF-Token
'
]
=
$
.
rails
.
csrfToken
();
}
next
();
...
...
spec/support/wait_for_vue_resource.rb
View file @
96c7bd03
module
WaitForVueResource
def
wait_for_vue_resource
(
spinner:
true
)
Timeout
.
timeout
(
Capybara
.
default_max_wait_time
)
do
loop
until
page
.
evaluate_script
(
'
Vue.activ
eResources'
).
zero?
loop
until
page
.
evaluate_script
(
'
window.activeVu
eResources'
).
zero?
end
end
end
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