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
e0bbadc2
Commit
e0bbadc2
authored
Dec 07, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use exported methods instead of gl.utils
parent
13df7a85
Changes
47
Hide whitespace changes
Inline
Side-by-side
Showing
47 changed files
with
140 additions
and
126 deletions
+140
-126
app/assets/javascripts/admin.js
app/assets/javascripts/admin.js
+3
-2
app/assets/javascripts/behaviors/toggler_behavior.js
app/assets/javascripts/behaviors/toggler_behavior.js
+2
-1
app/assets/javascripts/blob/blob_file_dropzone.js
app/assets/javascripts/blob/blob_file_dropzone.js
+2
-2
app/assets/javascripts/blob/blob_line_permalink_updater.js
app/assets/javascripts/blob/blob_line_permalink_updater.js
+3
-1
app/assets/javascripts/diff.js
app/assets/javascripts/diff.js
+4
-4
app/assets/javascripts/filtered_search/filtered_search_manager.js
...ts/javascripts/filtered_search/filtered_search_manager.js
+2
-1
app/assets/javascripts/gl_dropdown.js
app/assets/javascripts/gl_dropdown.js
+2
-1
app/assets/javascripts/groups/components/app.vue
app/assets/javascripts/groups/components/app.vue
+2
-2
app/assets/javascripts/groups/components/group_item.vue
app/assets/javascripts/groups/components/group_item.vue
+2
-1
app/assets/javascripts/groups/new_group_child.js
app/assets/javascripts/groups/new_group_child.js
+3
-2
app/assets/javascripts/issue_show/components/app.vue
app/assets/javascripts/issue_show/components/app.vue
+3
-3
app/assets/javascripts/job.js
app/assets/javascripts/job.js
+2
-1
app/assets/javascripts/lib/utils/common_utils.js
app/assets/javascripts/lib/utils/common_utils.js
+2
-1
app/assets/javascripts/lib/utils/url_utility.js
app/assets/javascripts/lib/utils/url_utility.js
+4
-19
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+3
-3
app/assets/javascripts/merge_request_tabs.js
app/assets/javascripts/merge_request_tabs.js
+2
-1
app/assets/javascripts/namespace_select.js
app/assets/javascripts/namespace_select.js
+2
-2
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+2
-1
app/assets/javascripts/notes/components/issue_notes_app.vue
app/assets/javascripts/notes/components/issue_notes_app.vue
+2
-1
app/assets/javascripts/pager.js
app/assets/javascripts/pager.js
+2
-2
app/assets/javascripts/performance_bar.js
app/assets/javascripts/performance_bar.js
+2
-1
app/assets/javascripts/project.js
app/assets/javascripts/project.js
+2
-1
app/assets/javascripts/projects/project_import_gitlab_project.js
...ets/javascripts/projects/project_import_gitlab_project.js
+2
-2
app/assets/javascripts/repo/stores/actions.js
app/assets/javascripts/repo/stores/actions.js
+2
-1
app/assets/javascripts/repo/stores/actions/tree.js
app/assets/javascripts/repo/stores/actions/tree.js
+2
-1
app/assets/javascripts/shortcuts.js
app/assets/javascripts/shortcuts.js
+3
-2
app/assets/javascripts/shortcuts_blob.js
app/assets/javascripts/shortcuts_blob.js
+3
-3
app/assets/javascripts/sidebar/sidebar_mediator.js
app/assets/javascripts/sidebar/sidebar_mediator.js
+2
-1
app/assets/javascripts/todos.js
app/assets/javascripts/todos.js
+2
-2
app/assets/javascripts/tree.js
app/assets/javascripts/tree.js
+3
-2
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_deployment.js
...e_merge_request_widget/components/mr_widget_deployment.js
+2
-1
spec/javascripts/filtered_search/filtered_search_manager_spec.js
...vascripts/filtered_search/filtered_search_manager_spec.js
+5
-5
spec/javascripts/gl_dropdown_spec.js
spec/javascripts/gl_dropdown_spec.js
+3
-3
spec/javascripts/groups/components/app_spec.js
spec/javascripts/groups/components/app_spec.js
+3
-3
spec/javascripts/groups/components/group_item_spec.js
spec/javascripts/groups/components/group_item_spec.js
+3
-3
spec/javascripts/issue_show/components/app_spec.js
spec/javascripts/issue_show/components/app_spec.js
+8
-7
spec/javascripts/job_spec.js
spec/javascripts/job_spec.js
+9
-9
spec/javascripts/merge_request_tabs_spec.js
spec/javascripts/merge_request_tabs_spec.js
+7
-6
spec/javascripts/notes_spec.js
spec/javascripts/notes_spec.js
+4
-6
spec/javascripts/pager_spec.js
spec/javascripts/pager_spec.js
+4
-3
spec/javascripts/repo/components/repo_commit_section_spec.js
spec/javascripts/repo/components/repo_commit_section_spec.js
+3
-2
spec/javascripts/repo/stores/actions/tree_spec.js
spec/javascripts/repo/stores/actions/tree_spec.js
+3
-2
spec/javascripts/repo/stores/actions_spec.js
spec/javascripts/repo/stores/actions_spec.js
+3
-2
spec/javascripts/search_autocomplete_spec.js
spec/javascripts/search_autocomplete_spec.js
+2
-1
spec/javascripts/sidebar/sidebar_mediator_spec.js
spec/javascripts/sidebar/sidebar_mediator_spec.js
+3
-2
spec/javascripts/todos_spec.js
spec/javascripts/todos_spec.js
+3
-2
spec/javascripts/vue_mr_widget/components/mr_widget_deployment_spec.js
...pts/vue_mr_widget/components/mr_widget_deployment_spec.js
+3
-2
No files found.
app/assets/javascripts/admin.js
View file @
e0bbadc2
/* eslint-disable func-names, space-before-function-paren, wrap-iife, one-var, no-var, one-var-declaration-per-line, no-unused-vars, no-else-return, prefer-arrow-callback, camelcase, quotes, comma-dangle, max-len */
/* eslint-disable func-names, space-before-function-paren, wrap-iife, one-var, no-var, one-var-declaration-per-line, no-unused-vars, no-else-return, prefer-arrow-callback, camelcase, quotes, comma-dangle, max-len */
import
{
refreshCurrentPage
}
from
'
./lib/utils/url_utility
'
;
window
.
Admin
=
(
function
()
{
window
.
Admin
=
(
function
()
{
function
Admin
()
{
function
Admin
()
{
...
@@ -40,10 +41,10 @@ window.Admin = (function() {
...
@@ -40,10 +41,10 @@ window.Admin = (function() {
return
$
(
'
.change-owner-link
'
).
show
();
return
$
(
'
.change-owner-link
'
).
show
();
});
});
$
(
'
li.project_member
'
).
bind
(
'
ajax:success
'
,
function
()
{
$
(
'
li.project_member
'
).
bind
(
'
ajax:success
'
,
function
()
{
return
gl
.
utils
.
refreshCurrentPage
();
return
refreshCurrentPage
();
});
});
$
(
'
li.group_member
'
).
bind
(
'
ajax:success
'
,
function
()
{
$
(
'
li.group_member
'
).
bind
(
'
ajax:success
'
,
function
()
{
return
gl
.
utils
.
refreshCurrentPage
();
return
refreshCurrentPage
();
});
});
showBlacklistType
=
function
()
{
showBlacklistType
=
function
()
{
if
(
$
(
"
input[name='blacklist_type']:checked
"
).
val
()
===
'
file
'
)
{
if
(
$
(
"
input[name='blacklist_type']:checked
"
).
val
()
===
'
file
'
)
{
...
...
app/assets/javascripts/behaviors/toggler_behavior.js
View file @
e0bbadc2
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
// %button.js-toggle-button
// %button.js-toggle-button
// %div.js-toggle-content
// %div.js-toggle-content
//
//
import
{
getLocationHash
}
from
'
../lib/utils/url_utility
'
;
$
(()
=>
{
$
(()
=>
{
function
toggleContainer
(
container
,
toggleState
)
{
function
toggleContainer
(
container
,
toggleState
)
{
...
@@ -32,7 +33,7 @@ $(() => {
...
@@ -32,7 +33,7 @@ $(() => {
// If we're accessing a permalink, ensure it is not inside a
// If we're accessing a permalink, ensure it is not inside a
// closed js-toggle-container!
// closed js-toggle-container!
const
hash
=
window
.
gl
.
utils
.
getLocationHash
();
const
hash
=
getLocationHash
();
const
anchor
=
hash
&&
document
.
getElementById
(
hash
);
const
anchor
=
hash
&&
document
.
getElementById
(
hash
);
const
container
=
anchor
&&
$
(
anchor
).
closest
(
'
.js-toggle-container
'
);
const
container
=
anchor
&&
$
(
anchor
).
closest
(
'
.js-toggle-container
'
);
...
...
app/assets/javascripts/blob/blob_file_dropzone.js
View file @
e0bbadc2
/* eslint-disable func-names, object-shorthand, prefer-arrow-callback */
/* eslint-disable func-names, object-shorthand, prefer-arrow-callback */
import
Dropzone
from
'
dropzone
'
;
import
Dropzone
from
'
dropzone
'
;
import
'
../lib/utils/url_utility
'
;
import
{
visitUrl
}
from
'
../lib/utils/url_utility
'
;
import
{
HIDDEN_CLASS
}
from
'
../lib/utils/constants
'
;
import
{
HIDDEN_CLASS
}
from
'
../lib/utils/constants
'
;
import
csrf
from
'
../lib/utils/csrf
'
;
import
csrf
from
'
../lib/utils/csrf
'
;
...
@@ -49,7 +49,7 @@ export default class BlobFileDropzone {
...
@@ -49,7 +49,7 @@ export default class BlobFileDropzone {
});
});
this
.
on
(
'
success
'
,
function
(
header
,
response
)
{
this
.
on
(
'
success
'
,
function
(
header
,
response
)
{
$
(
'
#modal-upload-blob
'
).
modal
(
'
hide
'
);
$
(
'
#modal-upload-blob
'
).
modal
(
'
hide
'
);
window
.
gl
.
utils
.
visitUrl
(
response
.
filePath
);
visitUrl
(
response
.
filePath
);
});
});
this
.
on
(
'
maxfilesexceeded
'
,
function
(
file
)
{
this
.
on
(
'
maxfilesexceeded
'
,
function
(
file
)
{
dropzoneMessage
.
addClass
(
HIDDEN_CLASS
);
dropzoneMessage
.
addClass
(
HIDDEN_CLASS
);
...
...
app/assets/javascripts/blob/blob_line_permalink_updater.js
View file @
e0bbadc2
import
{
getLocationHash
}
from
'
../lib/utils/url_utility
'
;
const
lineNumberRe
=
/^L
[
0-9
]
+/
;
const
lineNumberRe
=
/^L
[
0-9
]
+/
;
const
updateLineNumbersOnBlobPermalinks
=
(
linksToUpdate
)
=>
{
const
updateLineNumbersOnBlobPermalinks
=
(
linksToUpdate
)
=>
{
const
hash
=
g
l
.
utils
.
g
etLocationHash
();
const
hash
=
getLocationHash
();
if
(
hash
&&
lineNumberRe
.
test
(
hash
))
{
if
(
hash
&&
lineNumberRe
.
test
(
hash
))
{
const
hashUrlString
=
`#
${
hash
}
`
;
const
hashUrlString
=
`#
${
hash
}
`
;
...
...
app/assets/javascripts/diff.js
View file @
e0bbadc2
import
'
./lib/utils/url_utility
'
;
import
{
getLocationHash
}
from
'
./lib/utils/url_utility
'
;
import
FilesCommentButton
from
'
./files_comment_button
'
;
import
FilesCommentButton
from
'
./files_comment_button
'
;
import
SingleFileDiff
from
'
./single_file_diff
'
;
import
SingleFileDiff
from
'
./single_file_diff
'
;
import
imageDiffHelper
from
'
./image_diff/helpers/index
'
;
import
imageDiffHelper
from
'
./image_diff/helpers/index
'
;
...
@@ -31,7 +31,7 @@ export default class Diff {
...
@@ -31,7 +31,7 @@ export default class Diff {
isBound
=
true
;
isBound
=
true
;
}
}
if
(
g
l
.
utils
.
g
etLocationHash
())
{
if
(
getLocationHash
())
{
this
.
highlightSelectedLine
();
this
.
highlightSelectedLine
();
}
}
...
@@ -73,7 +73,7 @@ export default class Diff {
...
@@ -73,7 +73,7 @@ export default class Diff {
}
}
openAnchoredDiff
(
cb
)
{
openAnchoredDiff
(
cb
)
{
const
locationHash
=
g
l
.
utils
.
g
etLocationHash
();
const
locationHash
=
getLocationHash
();
const
anchoredDiff
=
locationHash
&&
locationHash
.
split
(
'
_
'
)[
0
];
const
anchoredDiff
=
locationHash
&&
locationHash
.
split
(
'
_
'
)[
0
];
if
(
!
anchoredDiff
)
return
;
if
(
!
anchoredDiff
)
return
;
...
@@ -128,7 +128,7 @@ export default class Diff {
...
@@ -128,7 +128,7 @@ export default class Diff {
}
}
// eslint-disable-next-line class-methods-use-this
// eslint-disable-next-line class-methods-use-this
highlightSelectedLine
()
{
highlightSelectedLine
()
{
const
hash
=
g
l
.
utils
.
g
etLocationHash
();
const
hash
=
getLocationHash
();
const
$diffFiles
=
$
(
'
.diff-file
'
);
const
$diffFiles
=
$
(
'
.diff-file
'
);
$diffFiles
.
find
(
'
.hll
'
).
removeClass
(
'
hll
'
);
$diffFiles
.
find
(
'
.hll
'
).
removeClass
(
'
hll
'
);
...
...
app/assets/javascripts/filtered_search/filtered_search_manager.js
View file @
e0bbadc2
import
*
as
urlUtils
from
'
../lib/utils/url_utility
'
;
import
Flash
from
'
../flash
'
;
import
Flash
from
'
../flash
'
;
import
FilteredSearchContainer
from
'
./container
'
;
import
FilteredSearchContainer
from
'
./container
'
;
import
RecentSearchesRoot
from
'
./recent_searches_root
'
;
import
RecentSearchesRoot
from
'
./recent_searches_root
'
;
...
@@ -566,7 +567,7 @@ class FilteredSearchManager {
...
@@ -566,7 +567,7 @@ class FilteredSearchManager {
if
(
this
.
updateObject
)
{
if
(
this
.
updateObject
)
{
this
.
updateObject
(
parameterizedUrl
);
this
.
updateObject
(
parameterizedUrl
);
}
else
{
}
else
{
gl
.
u
tils
.
visitUrl
(
parameterizedUrl
);
urlU
tils
.
visitUrl
(
parameterizedUrl
);
}
}
}
}
...
...
app/assets/javascripts/gl_dropdown.js
View file @
e0bbadc2
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
/* global fuzzaldrinPlus */
/* global fuzzaldrinPlus */
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
fuzzaldrinPlus
from
'
fuzzaldrin-plus
'
;
import
fuzzaldrinPlus
from
'
fuzzaldrin-plus
'
;
import
*
as
urlUtils
from
'
./lib/utils/url_utility
'
;
import
{
isObject
}
from
'
./lib/utils/type_utility
'
;
import
{
isObject
}
from
'
./lib/utils/type_utility
'
;
var
GitLabDropdown
,
GitLabDropdownFilter
,
GitLabDropdownRemote
,
GitLabDropdownInput
;
var
GitLabDropdown
,
GitLabDropdownFilter
,
GitLabDropdownRemote
,
GitLabDropdownInput
;
...
@@ -852,7 +853,7 @@ GitLabDropdown = (function() {
...
@@ -852,7 +853,7 @@ GitLabDropdown = (function() {
if
(
$el
.
length
)
{
if
(
$el
.
length
)
{
var
href
=
$el
.
attr
(
'
href
'
);
var
href
=
$el
.
attr
(
'
href
'
);
if
(
href
&&
href
!==
'
#
'
)
{
if
(
href
&&
href
!==
'
#
'
)
{
gl
.
u
tils
.
visitUrl
(
href
);
urlU
tils
.
visitUrl
(
href
);
}
else
{
}
else
{
$el
.
trigger
(
'
click
'
);
$el
.
trigger
(
'
click
'
);
}
}
...
...
app/assets/javascripts/groups/components/app.vue
View file @
e0bbadc2
...
@@ -5,7 +5,7 @@ import eventHub from '../event_hub';
...
@@ -5,7 +5,7 @@ import eventHub from '../event_hub';
import
{
getParameterByName
}
from
'
../../lib/utils/common_utils
'
;
import
{
getParameterByName
}
from
'
../../lib/utils/common_utils
'
;
import
loadingIcon
from
'
../../vue_shared/components/loading_icon.vue
'
;
import
loadingIcon
from
'
../../vue_shared/components/loading_icon.vue
'
;
import
{
COMMON_STR
}
from
'
../constants
'
;
import
{
COMMON_STR
}
from
'
../constants
'
;
import
*
as
utils
from
'
../../lib/utils/url_utility
'
;
import
groupsComponent
from
'
./groups.vue
'
;
import
groupsComponent
from
'
./groups.vue
'
;
export
default
{
export
default
{
...
@@ -93,7 +93,7 @@ export default {
...
@@ -93,7 +93,7 @@ export default {
this
.
isLoading
=
false
;
this
.
isLoading
=
false
;
$
.
scrollTo
(
0
);
$
.
scrollTo
(
0
);
const
currentPath
=
gl
.
utils
.
mergeUrlParams
({
page
},
window
.
location
.
href
);
const
currentPath
=
utils
.
mergeUrlParams
({
page
},
window
.
location
.
href
);
window
.
history
.
replaceState
({
window
.
history
.
replaceState
({
page
:
currentPath
,
page
:
currentPath
,
},
document
.
title
,
currentPath
);
},
document
.
title
,
currentPath
);
...
...
app/assets/javascripts/groups/components/group_item.vue
View file @
e0bbadc2
<
script
>
<
script
>
import
*
as
urlUtils
from
'
../../lib/utils/url_utility
'
;
import
tooltip
from
'
../../vue_shared/directives/tooltip
'
;
import
tooltip
from
'
../../vue_shared/directives/tooltip
'
;
import
identicon
from
'
../../vue_shared/components/identicon.vue
'
;
import
identicon
from
'
../../vue_shared/components/identicon.vue
'
;
import
eventHub
from
'
../event_hub
'
;
import
eventHub
from
'
../event_hub
'
;
...
@@ -60,7 +61,7 @@ export default {
...
@@ -60,7 +61,7 @@ export default {
if
(
this
.
hasChildren
)
{
if
(
this
.
hasChildren
)
{
eventHub
.
$emit
(
'
toggleChildren
'
,
this
.
group
);
eventHub
.
$emit
(
'
toggleChildren
'
,
this
.
group
);
}
else
{
}
else
{
gl
.
u
tils
.
visitUrl
(
this
.
group
.
relativePath
);
urlU
tils
.
visitUrl
(
this
.
group
.
relativePath
);
}
}
}
}
},
},
...
...
app/assets/javascripts/groups/new_group_child.js
View file @
e0bbadc2
import
{
visitUrl
}
from
'
../lib/utils/url_utility
'
;
import
DropLab
from
'
../droplab/drop_lab
'
;
import
DropLab
from
'
../droplab/drop_lab
'
;
import
ISetter
from
'
../droplab/plugins/input_setter
'
;
import
ISetter
from
'
../droplab/plugins/input_setter
'
;
...
@@ -54,9 +55,9 @@ export default class NewGroupChild {
...
@@ -54,9 +55,9 @@ export default class NewGroupChild {
onClickNewGroupChildButton
(
e
)
{
onClickNewGroupChildButton
(
e
)
{
if
(
e
.
target
.
dataset
.
action
===
NEW_PROJECT
)
{
if
(
e
.
target
.
dataset
.
action
===
NEW_PROJECT
)
{
gl
.
utils
.
visitUrl
(
this
.
newGroupPath
);
visitUrl
(
this
.
newGroupPath
);
}
else
if
(
e
.
target
.
dataset
.
action
===
NEW_SUBGROUP
)
{
}
else
if
(
e
.
target
.
dataset
.
action
===
NEW_SUBGROUP
)
{
gl
.
utils
.
visitUrl
(
this
.
subgroupPath
);
visitUrl
(
this
.
subgroupPath
);
}
}
}
}
}
}
app/assets/javascripts/issue_show/components/app.vue
View file @
e0bbadc2
<
script
>
<
script
>
import
Visibility
from
'
visibilityjs
'
;
import
Visibility
from
'
visibilityjs
'
;
import
*
as
urlUtils
from
'
../../lib/utils/url_utility
'
;
import
Poll
from
'
../../lib/utils/poll
'
;
import
Poll
from
'
../../lib/utils/poll
'
;
import
eventHub
from
'
../event_hub
'
;
import
eventHub
from
'
../event_hub
'
;
import
Service
from
'
../services/index
'
;
import
Service
from
'
../services/index
'
;
...
@@ -8,7 +9,6 @@ import titleComponent from './title.vue';
...
@@ -8,7 +9,6 @@ import titleComponent from './title.vue';
import
descriptionComponent
from
'
./description.vue
'
;
import
descriptionComponent
from
'
./description.vue
'
;
import
editedComponent
from
'
./edited.vue
'
;
import
editedComponent
from
'
./edited.vue
'
;
import
formComponent
from
'
./form.vue
'
;
import
formComponent
from
'
./form.vue
'
;
import
'
../../lib/utils/url_utility
'
;
export
default
{
export
default
{
props
:
{
props
:
{
...
@@ -169,7 +169,7 @@ export default {
...
@@ -169,7 +169,7 @@ export default {
.
then
(
res
=>
res
.
json
())
.
then
(
res
=>
res
.
json
())
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
if
(
location
.
pathname
!==
data
.
web_url
)
{
if
(
location
.
pathname
!==
data
.
web_url
)
{
gl
.
u
tils
.
visitUrl
(
data
.
web_url
);
urlU
tils
.
visitUrl
(
data
.
web_url
);
}
}
return
this
.
service
.
getData
();
return
this
.
service
.
getData
();
...
@@ -191,7 +191,7 @@ export default {
...
@@ -191,7 +191,7 @@ export default {
// Stop the poll so we don't get 404's with the issuable not existing
// Stop the poll so we don't get 404's with the issuable not existing
this
.
poll
.
stop
();
this
.
poll
.
stop
();
gl
.
u
tils
.
visitUrl
(
data
.
web_url
);
urlU
tils
.
visitUrl
(
data
.
web_url
);
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
eventHub
.
$emit
(
'
close.form
'
);
eventHub
.
$emit
(
'
close.form
'
);
...
...
app/assets/javascripts/job.js
View file @
e0bbadc2
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
*
as
urlUtils
from
'
./lib/utils/url_utility
'
;
import
bp
from
'
./breakpoints
'
;
import
bp
from
'
./breakpoints
'
;
import
{
bytesToKiB
}
from
'
./lib/utils/number_utils
'
;
import
{
bytesToKiB
}
from
'
./lib/utils/number_utils
'
;
import
{
setCiStatusFavicon
}
from
'
./lib/utils/common_utils
'
;
import
{
setCiStatusFavicon
}
from
'
./lib/utils/common_utils
'
;
...
@@ -209,7 +210,7 @@ export default class Job {
...
@@ -209,7 +210,7 @@ export default class Job {
}
}
if
(
log
.
status
!==
this
.
buildStatus
)
{
if
(
log
.
status
!==
this
.
buildStatus
)
{
gl
.
u
tils
.
visitUrl
(
this
.
pagePath
);
urlU
tils
.
visitUrl
(
this
.
pagePath
);
}
}
})
})
.
fail
(()
=>
{
.
fail
(()
=>
{
...
...
app/assets/javascripts/lib/utils/common_utils.js
View file @
e0bbadc2
import
{
getLocationHash
}
from
'
./url_utility
'
;
export
const
getPagePath
=
(
index
=
0
)
=>
$
(
'
body
'
).
attr
(
'
data-page
'
).
split
(
'
:
'
)[
index
];
export
const
getPagePath
=
(
index
=
0
)
=>
$
(
'
body
'
).
attr
(
'
data-page
'
).
split
(
'
:
'
)[
index
];
...
@@ -65,7 +66,7 @@ export const disableButtonIfEmptyField = (fieldSelector, buttonSelector, eventNa
...
@@ -65,7 +66,7 @@ export const disableButtonIfEmptyField = (fieldSelector, buttonSelector, eventNa
// automatically adjust scroll position for hash urls taking the height of the navbar into account
// automatically adjust scroll position for hash urls taking the height of the navbar into account
// https://github.com/twitter/bootstrap/issues/1768
// https://github.com/twitter/bootstrap/issues/1768
export
const
handleLocationHash
=
()
=>
{
export
const
handleLocationHash
=
()
=>
{
let
hash
=
window
.
gl
.
utils
.
getLocationHash
();
let
hash
=
getLocationHash
();
if
(
!
hash
)
return
;
if
(
!
hash
)
return
;
// This is required to handle non-unicode characters in hash
// This is required to handle non-unicode characters in hash
...
...
app/assets/javascripts/lib/utils/url_utility.js
View file @
e0bbadc2
...
@@ -17,20 +17,17 @@ export function getParameterValues(sParam) {
...
@@ -17,20 +17,17 @@ export function getParameterValues(sParam) {
// @param {Object} params - url keys and value to merge
// @param {Object} params - url keys and value to merge
// @param {String} url
// @param {String} url
export
function
mergeUrlParams
(
params
,
url
)
{
export
function
mergeUrlParams
(
params
,
url
)
{
let
newUrl
=
Object
.
keys
(
params
).
reduce
((
acc
Param
,
paramName
)
=>
{
let
newUrl
=
Object
.
keys
(
params
).
reduce
((
acc
,
paramName
)
=>
{
const
paramValue
=
params
[
paramName
];
const
paramValue
=
params
[
paramName
];
const
pattern
=
new
RegExp
(
`\\b(
${
paramName
}
=).*?(&|$)`
);
const
pattern
=
new
RegExp
(
`\\b(
${
paramName
}
=).*?(&|$)`
);
let
acc
=
accParam
;
if
(
paramValue
===
null
)
{
if
(
paramValue
===
null
)
{
acc
=
acc
.
replace
(
pattern
,
''
);
return
acc
.
replace
(
pattern
,
''
);
}
else
if
(
url
.
search
(
pattern
)
!==
-
1
)
{
}
else
if
(
url
.
search
(
pattern
)
!==
-
1
)
{
acc
=
acc
.
replace
(
pattern
,
`$1
${
paramValue
}
$2`
);
return
acc
.
replace
(
pattern
,
`$1
${
paramValue
}
$2`
);
}
else
{
acc
=
`
${
accParam
}${
accParam
.
indexOf
(
'
?
'
)
>
0
?
'
&
'
:
'
?
'
}${
paramName
}
=
${
paramValue
}
`
;
}
}
return
acc
;
return
`
${
acc
}${
acc
.
indexOf
(
'
?
'
)
>
0
?
'
&
'
:
'
?
'
}${
paramName
}
=
${
paramValue
}
`
;
},
decodeURIComponent
(
url
));
},
decodeURIComponent
(
url
));
// Remove a trailing ampersand
// Remove a trailing ampersand
...
@@ -86,15 +83,3 @@ export function refreshCurrentPage() {
...
@@ -86,15 +83,3 @@ export function refreshCurrentPage() {
export
function
redirectTo
(
url
)
{
export
function
redirectTo
(
url
)
{
return
window
.
location
.
assign
(
url
);
return
window
.
location
.
assign
(
url
);
}
}
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
utils
=
{
...(
window
.
gl
.
utils
||
{}),
mergeUrlParams
,
getLocationHash
,
getParameterValues
,
redirectTo
,
refreshCurrentPage
,
removeParams
,
visitUrl
,
};
app/assets/javascripts/main.js
View file @
e0bbadc2
...
@@ -29,7 +29,7 @@ import './commit/image_file';
...
@@ -29,7 +29,7 @@ import './commit/image_file';
// lib/utils
// lib/utils
import
{
handleLocationHash
}
from
'
./lib/utils/common_utils
'
;
import
{
handleLocationHash
}
from
'
./lib/utils/common_utils
'
;
import
'
./lib/utils/datetime_utility
'
;
import
'
./lib/utils/datetime_utility
'
;
import
'
./lib/utils/url_utility
'
;
import
{
getLocationHash
,
visitUrl
}
from
'
./lib/utils/url_utility
'
;
// behaviors
// behaviors
import
'
./behaviors/
'
;
import
'
./behaviors/
'
;
...
@@ -122,7 +122,7 @@ $(function () {
...
@@ -122,7 +122,7 @@ $(function () {
// `hashchange` is not triggered when link target is already in window.location
// `hashchange` is not triggered when link target is already in window.location
$body
.
on
(
'
click
'
,
'
a[href^="#"]
'
,
function
()
{
$body
.
on
(
'
click
'
,
'
a[href^="#"]
'
,
function
()
{
var
href
=
this
.
getAttribute
(
'
href
'
);
var
href
=
this
.
getAttribute
(
'
href
'
);
if
(
href
.
substr
(
1
)
===
g
l
.
utils
.
g
etLocationHash
())
{
if
(
href
.
substr
(
1
)
===
getLocationHash
())
{
setTimeout
(
handleLocationHash
,
1
);
setTimeout
(
handleLocationHash
,
1
);
}
}
});
});
...
@@ -294,7 +294,7 @@ $(function () {
...
@@ -294,7 +294,7 @@ $(function () {
const
action
=
`
${
this
.
action
}${
link
.
search
===
''
?
'
?
'
:
'
&
'
}
`
;
const
action
=
`
${
this
.
action
}${
link
.
search
===
''
?
'
?
'
:
'
&
'
}
`
;
event
.
preventDefault
();
event
.
preventDefault
();
gl
.
utils
.
visitUrl
(
`
${
action
}${
$
(
this
).
serialize
()}
`
);
visitUrl
(
`
${
action
}${
$
(
this
).
serialize
()}
`
);
});
});
const
flashContainer
=
document
.
querySelector
(
'
.flash-container
'
);
const
flashContainer
=
document
.
querySelector
(
'
.flash-container
'
);
...
...
app/assets/javascripts/merge_request_tabs.js
View file @
e0bbadc2
...
@@ -11,6 +11,7 @@ import {
...
@@ -11,6 +11,7 @@ import {
handleLocationHash
,
handleLocationHash
,
isMetaClick
,
isMetaClick
,
}
from
'
./lib/utils/common_utils
'
;
}
from
'
./lib/utils/common_utils
'
;
import
*
as
urlUtils
from
'
./lib/utils/url_utility
'
;
import
initDiscussionTab
from
'
./image_diff/init_discussion_tab
'
;
import
initDiscussionTab
from
'
./image_diff/init_discussion_tab
'
;
import
Diff
from
'
./diff
'
;
import
Diff
from
'
./diff
'
;
...
@@ -317,7 +318,7 @@ import Diff from './diff';
...
@@ -317,7 +318,7 @@ import Diff from './diff';
// Scroll any linked note into view
// Scroll any linked note into view
// Similar to `toggler_behavior` in the discussion tab
// Similar to `toggler_behavior` in the discussion tab
const
hash
=
window
.
gl
.
u
tils
.
getLocationHash
();
const
hash
=
urlU
tils
.
getLocationHash
();
const
anchor
=
hash
&&
$container
.
find
(
`.note[id="
${
hash
}
"]`
);
const
anchor
=
hash
&&
$container
.
find
(
`.note[id="
${
hash
}
"]`
);
if
(
anchor
&&
anchor
.
length
>
0
)
{
if
(
anchor
&&
anchor
.
length
>
0
)
{
const
notesContent
=
anchor
.
closest
(
'
.notes_content
'
);
const
notesContent
=
anchor
.
closest
(
'
.notes_content
'
);
...
...
app/assets/javascripts/namespace_select.js
View file @
e0bbadc2
/* eslint-disable func-names, space-before-function-paren, no-var, comma-dangle, object-shorthand, no-else-return, prefer-template, quotes, prefer-arrow-callback, max-len */
/* eslint-disable func-names, space-before-function-paren, no-var, comma-dangle, object-shorthand, no-else-return, prefer-template, quotes, prefer-arrow-callback, max-len */
import
Api
from
'
./api
'
;
import
Api
from
'
./api
'
;
import
'
./lib/utils/url_utility
'
;
import
{
mergeUrlParams
}
from
'
./lib/utils/url_utility
'
;
export
default
class
NamespaceSelect
{
export
default
class
NamespaceSelect
{
constructor
(
opts
)
{
constructor
(
opts
)
{
...
@@ -50,7 +50,7 @@ export default class NamespaceSelect {
...
@@ -50,7 +50,7 @@ export default class NamespaceSelect {
}
}
},
},
url
(
namespace
)
{
url
(
namespace
)
{
return
gl
.
utils
.
mergeUrlParams
({
[
fieldName
]:
namespace
.
id
},
window
.
location
.
href
);
return
mergeUrlParams
({
[
fieldName
]:
namespace
.
id
},
window
.
location
.
href
);
},
},
});
});
}
}
...
...
app/assets/javascripts/notes.js
View file @
e0bbadc2
...
@@ -16,6 +16,7 @@ import Autosize from 'autosize';
...
@@ -16,6 +16,7 @@ import Autosize from 'autosize';
import
'
vendor/jquery.caret
'
;
// required by jquery.atwho
import
'
vendor/jquery.caret
'
;
// required by jquery.atwho
import
'
vendor/jquery.atwho
'
;
import
'
vendor/jquery.atwho
'
;
import
AjaxCache
from
'
~/lib/utils/ajax_cache
'
;
import
AjaxCache
from
'
~/lib/utils/ajax_cache
'
;
import
*
as
urlUtils
from
'
./lib/utils/url_utility
'
;
import
Flash
from
'
./flash
'
;
import
Flash
from
'
./flash
'
;
import
CommentTypeToggle
from
'
./comment_type_toggle
'
;
import
CommentTypeToggle
from
'
./comment_type_toggle
'
;
import
GLForm
from
'
./gl_form
'
;
import
GLForm
from
'
./gl_form
'
;
...
@@ -330,7 +331,7 @@ export default class Notes {
...
@@ -330,7 +331,7 @@ export default class Notes {
}
}
static
updateNoteTargetSelector
(
$note
)
{
static
updateNoteTargetSelector
(
$note
)
{
const
hash
=
gl
.
u
tils
.
getLocationHash
();
const
hash
=
urlU
tils
.
getLocationHash
();
// Needs to be an explicit true/false for the jQuery `toggleClass(force)`
// Needs to be an explicit true/false for the jQuery `toggleClass(force)`
const
addTargetClass
=
Boolean
(
hash
&&
$note
.
filter
(
`#
${
hash
}
`
).
length
>
0
);
const
addTargetClass
=
Boolean
(
hash
&&
$note
.
filter
(
`#
${
hash
}
`
).
length
>
0
);
$note
.
toggleClass
(
'
target
'
,
addTargetClass
);
$note
.
toggleClass
(
'
target
'
,
addTargetClass
);
...
...
app/assets/javascripts/notes/components/issue_notes_app.vue
View file @
e0bbadc2
<
script
>
<
script
>
import
{
mapGetters
,
mapActions
}
from
'
vuex
'
;
import
{
mapGetters
,
mapActions
}
from
'
vuex
'
;
import
{
getLocationHash
}
from
'
../../lib/utils/url_utility
'
;
import
Flash
from
'
../../flash
'
;
import
Flash
from
'
../../flash
'
;
import
store
from
'
../stores/
'
;
import
store
from
'
../stores/
'
;
import
*
as
constants
from
'
../constants
'
;
import
*
as
constants
from
'
../constants
'
;
...
@@ -95,7 +96,7 @@
...
@@ -95,7 +96,7 @@
this
.
poll
();
this
.
poll
();
},
},
checkLocationHash
()
{
checkLocationHash
()
{
const
hash
=
g
l
.
utils
.
g
etLocationHash
();
const
hash
=
getLocationHash
();
const
element
=
document
.
getElementById
(
hash
);
const
element
=
document
.
getElementById
(
hash
);
if
(
hash
&&
element
)
{
if
(
hash
&&
element
)
{
...
...
app/assets/javascripts/pager.js
View file @
e0bbadc2
import
{
getParameterByName
}
from
'
~/lib/utils/common_utils
'
;
import
{
getParameterByName
}
from
'
~/lib/utils/common_utils
'
;
import
'
~
/lib/utils/url_utility
'
;
import
*
as
utils
from
'
.
/lib/utils/url_utility
'
;
(()
=>
{
(()
=>
{
const
ENDLESS_SCROLL_BOTTOM_PX
=
400
;
const
ENDLESS_SCROLL_BOTTOM_PX
=
400
;
...
@@ -7,7 +7,7 @@ import '~/lib/utils/url_utility';
...
@@ -7,7 +7,7 @@ import '~/lib/utils/url_utility';
const
Pager
=
{
const
Pager
=
{
init
(
limit
=
0
,
preload
=
false
,
disable
=
false
,
prepareData
=
$
.
noop
,
callback
=
$
.
noop
)
{
init
(
limit
=
0
,
preload
=
false
,
disable
=
false
,
prepareData
=
$
.
noop
,
callback
=
$
.
noop
)
{
this
.
url
=
$
(
'
.content_list
'
).
data
(
'
href
'
)
||
gl
.
utils
.
removeParams
([
'
limit
'
,
'
offset
'
]);
this
.
url
=
$
(
'
.content_list
'
).
data
(
'
href
'
)
||
utils
.
removeParams
([
'
limit
'
,
'
offset
'
]);
this
.
limit
=
limit
;
this
.
limit
=
limit
;
this
.
offset
=
parseInt
(
getParameterByName
(
'
offset
'
),
10
)
||
this
.
limit
;
this
.
offset
=
parseInt
(
getParameterByName
(
'
offset
'
),
10
)
||
this
.
limit
;
this
.
disable
=
disable
;
this
.
disable
=
disable
;
...
...
app/assets/javascripts/performance_bar.js
View file @
e0bbadc2
import
'
vendor/peek
'
;
import
'
vendor/peek
'
;
import
'
vendor/peek.performance_bar
'
;
import
'
vendor/peek.performance_bar
'
;
import
{
getParameterValues
}
from
'
./lib/utils/url_utility
'
;
export
default
class
PerformanceBar
{
export
default
class
PerformanceBar
{
constructor
(
opts
)
{
constructor
(
opts
)
{
...
@@ -39,7 +40,7 @@ export default class PerformanceBar {
...
@@ -39,7 +40,7 @@ export default class PerformanceBar {
}
}
handleLineProfileLink
(
e
)
{
handleLineProfileLink
(
e
)
{
const
lineProfilerParameter
=
g
l
.
utils
.
g
etParameterValues
(
'
lineprofiler
'
);
const
lineProfilerParameter
=
getParameterValues
(
'
lineprofiler
'
);
const
lineProfilerParameterRegex
=
new
RegExp
(
`lineprofiler=
${
lineProfilerParameter
[
0
]}
`
);
const
lineProfilerParameterRegex
=
new
RegExp
(
`lineprofiler=
${
lineProfilerParameter
[
0
]}
`
);
const
shouldToggleModal
=
lineProfilerParameter
.
length
>
0
&&
const
shouldToggleModal
=
lineProfilerParameter
.
length
>
0
&&
lineProfilerParameterRegex
.
test
(
e
.
currentTarget
.
href
);
lineProfilerParameterRegex
.
test
(
e
.
currentTarget
.
href
);
...
...
app/assets/javascripts/project.js
View file @
e0bbadc2
/* eslint-disable func-names, space-before-function-paren, no-var, consistent-return, no-new, prefer-arrow-callback, no-return-assign, one-var, one-var-declaration-per-line, object-shorthand, no-else-return, newline-per-chained-call, no-shadow, vars-on-top, prefer-template, max-len */
/* eslint-disable func-names, space-before-function-paren, no-var, consistent-return, no-new, prefer-arrow-callback, no-return-assign, one-var, one-var-declaration-per-line, object-shorthand, no-else-return, newline-per-chained-call, no-shadow, vars-on-top, prefer-template, max-len */
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
{
visitUrl
}
from
'
./lib/utils/url_utility
'
;
import
projectSelect
from
'
./project_select
'
;
import
projectSelect
from
'
./project_select
'
;
export
default
class
Project
{
export
default
class
Project
{
...
@@ -122,7 +123,7 @@ export default class Project {
...
@@ -122,7 +123,7 @@ export default class Project {
var
action
=
$form
.
attr
(
'
action
'
);
var
action
=
$form
.
attr
(
'
action
'
);
var
divider
=
action
.
indexOf
(
'
?
'
)
===
-
1
?
'
?
'
:
'
&
'
;
var
divider
=
action
.
indexOf
(
'
?
'
)
===
-
1
?
'
?
'
:
'
&
'
;
if
(
shouldVisit
)
{
if
(
shouldVisit
)
{
gl
.
utils
.
visitUrl
(
`
${
action
}${
divider
}${
$form
.
serialize
()}
`
);
visitUrl
(
`
${
action
}${
divider
}${
$form
.
serialize
()}
`
);
}
}
}
}
},
},
...
...
app/assets/javascripts/projects/project_import_gitlab_project.js
View file @
e0bbadc2
import
'
../lib/utils/url_utility
'
;
import
{
getParameterValues
}
from
'
../lib/utils/url_utility
'
;
const
bindEvents
=
()
=>
{
const
bindEvents
=
()
=>
{
const
path
=
g
l
.
utils
.
g
etParameterValues
(
'
path
'
)[
0
];
const
path
=
getParameterValues
(
'
path
'
)[
0
];
// get the path url and append it in the inputS
// get the path url and append it in the inputS
$
(
'
.js-path-name
'
).
val
(
path
);
$
(
'
.js-path-name
'
).
val
(
path
);
...
...
app/assets/javascripts/repo/stores/actions.js
View file @
e0bbadc2
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
*
as
urlUtils
from
'
../../lib/utils/url_utility
'
;
import
flash
from
'
../../flash
'
;
import
flash
from
'
../../flash
'
;
import
service
from
'
../services
'
;
import
service
from
'
../services
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
*
as
types
from
'
./mutation_types
'
;
export
const
redirectToUrl
=
(
_
,
url
)
=>
gl
.
u
tils
.
visitUrl
(
url
);
export
const
redirectToUrl
=
(
_
,
url
)
=>
urlU
tils
.
visitUrl
(
url
);
export
const
setInitialData
=
({
commit
},
data
)
=>
commit
(
types
.
SET_INITIAL_DATA
,
data
);
export
const
setInitialData
=
({
commit
},
data
)
=>
commit
(
types
.
SET_INITIAL_DATA
,
data
);
...
...
app/assets/javascripts/repo/stores/actions/tree.js
View file @
e0bbadc2
import
*
as
urlUtils
from
'
../../../lib/utils/url_utility
'
;
import
{
normalizeHeaders
}
from
'
../../../lib/utils/common_utils
'
;
import
{
normalizeHeaders
}
from
'
../../../lib/utils/common_utils
'
;
import
flash
from
'
../../../flash
'
;
import
flash
from
'
../../../flash
'
;
import
service
from
'
../../services
'
;
import
service
from
'
../../services
'
;
...
@@ -73,7 +74,7 @@ export const clickedTreeRow = ({ commit, dispatch }, row) => {
...
@@ -73,7 +74,7 @@ export const clickedTreeRow = ({ commit, dispatch }, row) => {
}
else
if
(
row
.
type
===
'
submodule
'
)
{
}
else
if
(
row
.
type
===
'
submodule
'
)
{
commit
(
types
.
TOGGLE_LOADING
,
row
);
commit
(
types
.
TOGGLE_LOADING
,
row
);
gl
.
u
tils
.
visitUrl
(
row
.
url
);
urlU
tils
.
visitUrl
(
row
.
url
);
}
else
if
(
row
.
type
===
'
blob
'
&&
row
.
opened
)
{
}
else
if
(
row
.
type
===
'
blob
'
&&
row
.
opened
)
{
dispatch
(
'
setFileActive
'
,
row
);
dispatch
(
'
setFileActive
'
,
row
);
}
else
{
}
else
{
...
...
app/assets/javascripts/shortcuts.js
View file @
e0bbadc2
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
Mousetrap
from
'
mousetrap
'
;
import
Mousetrap
from
'
mousetrap
'
;
import
{
refreshCurrentPage
,
visitUrl
}
from
'
./lib/utils/url_utility
'
;
import
findAndFollowLink
from
'
./shortcuts_dashboard_navigation
'
;
import
findAndFollowLink
from
'
./shortcuts_dashboard_navigation
'
;
const
defaultStopCallback
=
Mousetrap
.
stopCallback
;
const
defaultStopCallback
=
Mousetrap
.
stopCallback
;
...
@@ -38,7 +39,7 @@ export default class Shortcuts {
...
@@ -38,7 +39,7 @@ export default class Shortcuts {
if
(
typeof
findFileURL
!==
'
undefined
'
&&
findFileURL
!==
null
)
{
if
(
typeof
findFileURL
!==
'
undefined
'
&&
findFileURL
!==
null
)
{
Mousetrap
.
bind
(
'
t
'
,
()
=>
{
Mousetrap
.
bind
(
'
t
'
,
()
=>
{
gl
.
utils
.
visitUrl
(
findFileURL
);
visitUrl
(
findFileURL
);
});
});
}
}
...
@@ -62,7 +63,7 @@ export default class Shortcuts {
...
@@ -62,7 +63,7 @@ export default class Shortcuts {
}
else
{
}
else
{
Cookies
.
set
(
performanceBarCookieName
,
'
true
'
,
{
path
:
'
/
'
});
Cookies
.
set
(
performanceBarCookieName
,
'
true
'
,
{
path
:
'
/
'
});
}
}
gl
.
utils
.
refreshCurrentPage
();
refreshCurrentPage
();
}
}
static
toggleMarkdownPreview
(
e
)
{
static
toggleMarkdownPreview
(
e
)
{
...
...
app/assets/javascripts/shortcuts_blob.js
View file @
e0bbadc2
/* global Mousetrap */
/* global Mousetrap */
import
{
getLocationHash
,
visitUrl
}
from
'
./lib/utils/url_utility
'
;
import
Shortcuts
from
'
./shortcuts
'
;
import
Shortcuts
from
'
./shortcuts
'
;
const
defaults
=
{
const
defaults
=
{
...
@@ -18,9 +18,9 @@ export default class ShortcutsBlob extends Shortcuts {
...
@@ -18,9 +18,9 @@ export default class ShortcutsBlob extends Shortcuts {
moveToFilePermalink
()
{
moveToFilePermalink
()
{
if
(
this
.
options
.
fileBlobPermalinkUrl
)
{
if
(
this
.
options
.
fileBlobPermalinkUrl
)
{
const
hash
=
g
l
.
utils
.
g
etLocationHash
();
const
hash
=
getLocationHash
();
const
hashUrlString
=
hash
?
`#
${
hash
}
`
:
''
;
const
hashUrlString
=
hash
?
`#
${
hash
}
`
:
''
;
gl
.
utils
.
visitUrl
(
`
${
this
.
options
.
fileBlobPermalinkUrl
}${
hashUrlString
}
`
);
visitUrl
(
`
${
this
.
options
.
fileBlobPermalinkUrl
}${
hashUrlString
}
`
);
}
}
}
}
}
}
app/assets/javascripts/sidebar/sidebar_mediator.js
View file @
e0bbadc2
import
*
as
urlUtils
from
'
../lib/utils/url_utility
'
;
import
Flash
from
'
../flash
'
;
import
Flash
from
'
../flash
'
;
import
Service
from
'
./services/sidebar_service
'
;
import
Service
from
'
./services/sidebar_service
'
;
import
Store
from
'
./stores/sidebar_store
'
;
import
Store
from
'
./stores/sidebar_store
'
;
...
@@ -81,7 +82,7 @@ export default class SidebarMediator {
...
@@ -81,7 +82,7 @@ export default class SidebarMediator {
.
then
(
response
=>
response
.
json
())
.
then
(
response
=>
response
.
json
())
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
if
(
location
.
pathname
!==
data
.
web_url
)
{
if
(
location
.
pathname
!==
data
.
web_url
)
{
gl
.
u
tils
.
visitUrl
(
data
.
web_url
);
urlU
tils
.
visitUrl
(
data
.
web_url
);
}
}
});
});
}
}
...
...
app/assets/javascripts/todos.js
View file @
e0bbadc2
/* eslint-disable class-methods-use-this, no-unneeded-ternary, quote-props */
/* eslint-disable class-methods-use-this, no-unneeded-ternary, quote-props */
import
*
as
urlUtils
from
'
./lib/utils/url_utility
'
;
import
UsersSelect
from
'
./users_select
'
;
import
UsersSelect
from
'
./users_select
'
;
import
{
isMetaClick
}
from
'
./lib/utils/common_utils
'
;
import
{
isMetaClick
}
from
'
./lib/utils/common_utils
'
;
...
@@ -150,7 +150,7 @@ export default class Todos {
...
@@ -150,7 +150,7 @@ export default class Todos {
window
.
open
(
todoLink
,
windowTarget
);
window
.
open
(
todoLink
,
windowTarget
);
}
else
{
}
else
{
gl
.
u
tils
.
visitUrl
(
todoLink
);
urlU
tils
.
visitUrl
(
todoLink
);
}
}
}
}
}
}
app/assets/javascripts/tree.js
View file @
e0bbadc2
/* eslint-disable func-names, space-before-function-paren, wrap-iife, max-len, quotes, consistent-return, no-var, one-var, one-var-declaration-per-line, no-else-return, prefer-arrow-callback, class-methods-use-this */
/* eslint-disable func-names, space-before-function-paren, wrap-iife, max-len, quotes, consistent-return, no-var, one-var, one-var-declaration-per-line, no-else-return, prefer-arrow-callback, class-methods-use-this */
import
{
visitUrl
}
from
'
./lib/utils/url_utility
'
;
export
default
class
TreeView
{
export
default
class
TreeView
{
constructor
()
{
constructor
()
{
...
@@ -14,7 +15,7 @@ export default class TreeView {
...
@@ -14,7 +15,7 @@ export default class TreeView {
e
.
preventDefault
();
e
.
preventDefault
();
return
window
.
open
(
path
,
'
_blank
'
);
return
window
.
open
(
path
,
'
_blank
'
);
}
else
{
}
else
{
return
gl
.
utils
.
visitUrl
(
path
);
return
visitUrl
(
path
);
}
}
}
}
});
});
...
@@ -56,7 +57,7 @@ export default class TreeView {
...
@@ -56,7 +57,7 @@ export default class TreeView {
}
else
if
(
e
.
which
===
13
)
{
}
else
if
(
e
.
which
===
13
)
{
path
=
$
(
'
.tree-item.selected .tree-item-file-name a
'
).
attr
(
'
href
'
);
path
=
$
(
'
.tree-item.selected .tree-item-file-name a
'
).
attr
(
'
href
'
);
if
(
path
)
{
if
(
path
)
{
return
gl
.
utils
.
visitUrl
(
path
);
return
visitUrl
(
path
);
}
}
}
}
});
});
...
...
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_deployment.js
View file @
e0bbadc2
import
'
~/lib/utils/datetime_utility
'
;
import
'
~/lib/utils/datetime_utility
'
;
import
*
as
urlUtils
from
'
../../lib/utils/url_utility
'
;
import
Flash
from
'
../../flash
'
;
import
Flash
from
'
../../flash
'
;
import
MemoryUsage
from
'
./mr_widget_memory_usage
'
;
import
MemoryUsage
from
'
./mr_widget_memory_usage
'
;
import
StatusIcon
from
'
./mr_widget_status_icon
'
;
import
StatusIcon
from
'
./mr_widget_status_icon
'
;
...
@@ -36,7 +37,7 @@ export default {
...
@@ -36,7 +37,7 @@ export default {
.
then
(
res
=>
res
.
json
())
.
then
(
res
=>
res
.
json
())
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
res
.
redirect_url
)
{
if
(
res
.
redirect_url
)
{
gl
.
u
tils
.
visitUrl
(
res
.
redirect_url
);
urlU
tils
.
visitUrl
(
res
.
redirect_url
);
}
}
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
...
...
spec/javascripts/filtered_search/filtered_search_manager_spec.js
View file @
e0bbadc2
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
*
as
recentSearchesStoreSrc
from
'
~/filtered_search/stores/recent_searches_store
'
;
import
*
as
recentSearchesStoreSrc
from
'
~/filtered_search/stores/recent_searches_store
'
;
import
RecentSearchesService
from
'
~/filtered_search/services/recent_searches_service
'
;
import
RecentSearchesService
from
'
~/filtered_search/services/recent_searches_service
'
;
import
RecentSearchesServiceError
from
'
~/filtered_search/services/recent_searches_service_error
'
;
import
RecentSearchesServiceError
from
'
~/filtered_search/services/recent_searches_service_error
'
;
import
RecentSearchesRoot
from
'
~/filtered_search/recent_searches_root
'
;
import
RecentSearchesRoot
from
'
~/filtered_search/recent_searches_root
'
;
import
'
~/lib/utils/url_utility
'
;
import
'
~/lib/utils/common_utils
'
;
import
'
~/lib/utils/common_utils
'
;
import
'
~/filtered_search/filtered_search_token_keys
'
;
import
'
~/filtered_search/filtered_search_token_keys
'
;
import
'
~/filtered_search/filtered_search_tokenizer
'
;
import
'
~/filtered_search/filtered_search_tokenizer
'
;
...
@@ -162,7 +162,7 @@ describe('Filtered Search Manager', () => {
...
@@ -162,7 +162,7 @@ describe('Filtered Search Manager', () => {
it
(
'
should search with a single word
'
,
(
done
)
=>
{
it
(
'
should search with a single word
'
,
(
done
)
=>
{
input
.
value
=
'
searchTerm
'
;
input
.
value
=
'
searchTerm
'
;
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
spyOn
(
urlU
tils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&search=searchTerm`
);
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&search=searchTerm`
);
done
();
done
();
});
});
...
@@ -173,7 +173,7 @@ describe('Filtered Search Manager', () => {
...
@@ -173,7 +173,7 @@ describe('Filtered Search Manager', () => {
it
(
'
should search with multiple words
'
,
(
done
)
=>
{
it
(
'
should search with multiple words
'
,
(
done
)
=>
{
input
.
value
=
'
awesome search terms
'
;
input
.
value
=
'
awesome search terms
'
;
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
spyOn
(
urlU
tils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&search=awesome+search+terms`
);
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&search=awesome+search+terms`
);
done
();
done
();
});
});
...
@@ -184,7 +184,7 @@ describe('Filtered Search Manager', () => {
...
@@ -184,7 +184,7 @@ describe('Filtered Search Manager', () => {
it
(
'
should search with special characters
'
,
(
done
)
=>
{
it
(
'
should search with special characters
'
,
(
done
)
=>
{
input
.
value
=
'
~!@#$%^&*()_+{}:<>,.?/
'
;
input
.
value
=
'
~!@#$%^&*()_+{}:<>,.?/
'
;
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
spyOn
(
urlU
tils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&search=~!%40%23%24%25%5E%26*()_%2B%7B%7D%3A%3C%3E%2C.%3F%2F`
);
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&search=~!%40%23%24%25%5E%26*()_%2B%7B%7D%3A%3C%3E%2C.%3F%2F`
);
done
();
done
();
});
});
...
@@ -198,7 +198,7 @@ describe('Filtered Search Manager', () => {
...
@@ -198,7 +198,7 @@ describe('Filtered Search Manager', () => {
${
FilteredSearchSpecHelper
.
createFilterVisualTokenHTML
(
'
label
'
,
'
~bug
'
)}
${
FilteredSearchSpecHelper
.
createFilterVisualTokenHTML
(
'
label
'
,
'
~bug
'
)}
`
);
`
);
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
spyOn
(
urlU
tils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&label_name[]=bug`
);
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&label_name[]=bug`
);
done
();
done
();
});
});
...
...
spec/javascripts/gl_dropdown_spec.js
View file @
e0bbadc2
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
'
~/gl_dropdown
'
;
import
'
~/gl_dropdown
'
;
import
'
~/lib/utils/common_utils
'
;
import
'
~/lib/utils/common_utils
'
;
import
'
~/lib/utils/url_utility
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
describe
(
'
glDropdown
'
,
function
describeDropdown
()
{
describe
(
'
glDropdown
'
,
function
describeDropdown
()
{
preloadFixtures
(
'
static/gl_dropdown.html.raw
'
);
preloadFixtures
(
'
static/gl_dropdown.html.raw
'
);
...
@@ -137,13 +137,13 @@ describe('glDropdown', function describeDropdown() {
...
@@ -137,13 +137,13 @@ describe('glDropdown', function describeDropdown() {
expect
(
this
.
dropdownContainerElement
).
toHaveClass
(
'
open
'
);
expect
(
this
.
dropdownContainerElement
).
toHaveClass
(
'
open
'
);
const
randomIndex
=
Math
.
floor
(
Math
.
random
()
*
(
this
.
projectsData
.
length
-
1
))
+
0
;
const
randomIndex
=
Math
.
floor
(
Math
.
random
()
*
(
this
.
projectsData
.
length
-
1
))
+
0
;
navigateWithKeys
(
'
down
'
,
randomIndex
,
()
=>
{
navigateWithKeys
(
'
down
'
,
randomIndex
,
()
=>
{
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
).
and
.
stub
();
spyOn
(
urlU
tils
,
'
visitUrl
'
).
and
.
stub
();
navigateWithKeys
(
'
enter
'
,
null
,
()
=>
{
navigateWithKeys
(
'
enter
'
,
null
,
()
=>
{
expect
(
this
.
dropdownContainerElement
).
not
.
toHaveClass
(
'
open
'
);
expect
(
this
.
dropdownContainerElement
).
not
.
toHaveClass
(
'
open
'
);
const
link
=
$
(
`
${
ITEM_SELECTOR
}
:eq(
${
randomIndex
}
) a`
,
this
.
$dropdownMenuElement
);
const
link
=
$
(
`
${
ITEM_SELECTOR
}
:eq(
${
randomIndex
}
) a`
,
this
.
$dropdownMenuElement
);
expect
(
link
).
toHaveClass
(
'
is-active
'
);
expect
(
link
).
toHaveClass
(
'
is-active
'
);
const
linkedLocation
=
link
.
attr
(
'
href
'
);
const
linkedLocation
=
link
.
attr
(
'
href
'
);
if
(
linkedLocation
&&
linkedLocation
!==
'
#
'
)
expect
(
gl
.
u
tils
.
visitUrl
).
toHaveBeenCalledWith
(
linkedLocation
);
if
(
linkedLocation
&&
linkedLocation
!==
'
#
'
)
expect
(
urlU
tils
.
visitUrl
).
toHaveBeenCalledWith
(
linkedLocation
);
});
});
});
});
});
});
...
...
spec/javascripts/groups/components/app_spec.js
View file @
e0bbadc2
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
*
as
utils
from
'
~/lib/utils/url_utility
'
;
import
appComponent
from
'
~/groups/components/app.vue
'
;
import
appComponent
from
'
~/groups/components/app.vue
'
;
import
groupFolderComponent
from
'
~/groups/components/group_folder.vue
'
;
import
groupFolderComponent
from
'
~/groups/components/group_folder.vue
'
;
import
groupItemComponent
from
'
~/groups/components/group_item.vue
'
;
import
groupItemComponent
from
'
~/groups/components/group_item.vue
'
;
import
eventHub
from
'
~/groups/event_hub
'
;
import
eventHub
from
'
~/groups/event_hub
'
;
import
GroupsStore
from
'
~/groups/store/groups_store
'
;
import
GroupsStore
from
'
~/groups/store/groups_store
'
;
import
GroupsService
from
'
~/groups/service/groups_service
'
;
import
GroupsService
from
'
~/groups/service/groups_service
'
;
...
@@ -176,7 +176,7 @@ describe('AppComponent', () => {
...
@@ -176,7 +176,7 @@ describe('AppComponent', () => {
it
(
'
should fetch groups for provided page details and update window state
'
,
(
done
)
=>
{
it
(
'
should fetch groups for provided page details and update window state
'
,
(
done
)
=>
{
spyOn
(
vm
,
'
fetchGroups
'
).
and
.
returnValue
(
returnServicePromise
(
mockGroups
));
spyOn
(
vm
,
'
fetchGroups
'
).
and
.
returnValue
(
returnServicePromise
(
mockGroups
));
spyOn
(
vm
,
'
updateGroups
'
).
and
.
callThrough
();
spyOn
(
vm
,
'
updateGroups
'
).
and
.
callThrough
();
spyOn
(
gl
.
utils
,
'
mergeUrlParams
'
).
and
.
callThrough
();
spyOn
(
utils
,
'
mergeUrlParams
'
).
and
.
callThrough
();
spyOn
(
window
.
history
,
'
replaceState
'
);
spyOn
(
window
.
history
,
'
replaceState
'
);
spyOn
(
$
,
'
scrollTo
'
);
spyOn
(
$
,
'
scrollTo
'
);
...
@@ -192,7 +192,7 @@ describe('AppComponent', () => {
...
@@ -192,7 +192,7 @@ describe('AppComponent', () => {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
vm
.
isLoading
).
toBeFalsy
();
expect
(
vm
.
isLoading
).
toBeFalsy
();
expect
(
$
.
scrollTo
).
toHaveBeenCalledWith
(
0
);
expect
(
$
.
scrollTo
).
toHaveBeenCalledWith
(
0
);
expect
(
gl
.
utils
.
mergeUrlParams
).
toHaveBeenCalledWith
({
page
:
2
},
jasmine
.
any
(
String
));
expect
(
utils
.
mergeUrlParams
).
toHaveBeenCalledWith
({
page
:
2
},
jasmine
.
any
(
String
));
expect
(
window
.
history
.
replaceState
).
toHaveBeenCalledWith
({
expect
(
window
.
history
.
replaceState
).
toHaveBeenCalledWith
({
page
:
jasmine
.
any
(
String
),
page
:
jasmine
.
any
(
String
),
},
jasmine
.
any
(
String
),
jasmine
.
any
(
String
));
},
jasmine
.
any
(
String
),
jasmine
.
any
(
String
));
...
...
spec/javascripts/groups/components/group_item_spec.js
View file @
e0bbadc2
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
groupItemComponent
from
'
~/groups/components/group_item.vue
'
;
import
groupItemComponent
from
'
~/groups/components/group_item.vue
'
;
import
groupFolderComponent
from
'
~/groups/components/group_folder.vue
'
;
import
groupFolderComponent
from
'
~/groups/components/group_folder.vue
'
;
import
eventHub
from
'
~/groups/event_hub
'
;
import
eventHub
from
'
~/groups/event_hub
'
;
...
@@ -136,13 +136,13 @@ describe('GroupItemComponent', () => {
...
@@ -136,13 +136,13 @@ describe('GroupItemComponent', () => {
const
group
=
Object
.
assign
({},
mockParentGroupItem
);
const
group
=
Object
.
assign
({},
mockParentGroupItem
);
group
.
childrenCount
=
0
;
group
.
childrenCount
=
0
;
const
newVm
=
createComponent
(
group
);
const
newVm
=
createComponent
(
group
);
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
).
and
.
stub
();
spyOn
(
urlU
tils
,
'
visitUrl
'
).
and
.
stub
();
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
eventHub
,
'
$emit
'
);
newVm
.
onClickRowGroup
(
event
);
newVm
.
onClickRowGroup
(
event
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
eventHub
.
$emit
).
not
.
toHaveBeenCalled
();
expect
(
eventHub
.
$emit
).
not
.
toHaveBeenCalled
();
expect
(
gl
.
u
tils
.
visitUrl
).
toHaveBeenCalledWith
(
newVm
.
group
.
relativePath
);
expect
(
urlU
tils
.
visitUrl
).
toHaveBeenCalledWith
(
newVm
.
group
.
relativePath
);
done
();
done
();
},
0
);
},
0
);
});
});
...
...
spec/javascripts/issue_show/components/app_spec.js
View file @
e0bbadc2
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
'
~/render_math
'
;
import
'
~/render_math
'
;
import
'
~/render_gfm
'
;
import
'
~/render_gfm
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
issuableApp
from
'
~/issue_show/components/app.vue
'
;
import
issuableApp
from
'
~/issue_show/components/app.vue
'
;
import
eventHub
from
'
~/issue_show/event_hub
'
;
import
eventHub
from
'
~/issue_show/event_hub
'
;
import
issueShowData
from
'
../mock_data
'
;
import
issueShowData
from
'
../mock_data
'
;
...
@@ -177,7 +178,7 @@ describe('Issuable output', () => {
...
@@ -177,7 +178,7 @@ describe('Issuable output', () => {
});
});
it
(
'
does not redirect if issue has not moved
'
,
(
done
)
=>
{
it
(
'
does not redirect if issue has not moved
'
,
(
done
)
=>
{
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
);
spyOn
(
urlU
tils
,
'
visitUrl
'
);
spyOn
(
vm
.
service
,
'
updateIssuable
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
)
=>
{
spyOn
(
vm
.
service
,
'
updateIssuable
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
)
=>
{
resolve
({
resolve
({
json
()
{
json
()
{
...
@@ -193,7 +194,7 @@ describe('Issuable output', () => {
...
@@ -193,7 +194,7 @@ describe('Issuable output', () => {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
expect
(
gl
.
u
tils
.
visitUrl
,
urlU
tils
.
visitUrl
,
).
not
.
toHaveBeenCalled
();
).
not
.
toHaveBeenCalled
();
done
();
done
();
...
@@ -201,7 +202,7 @@ describe('Issuable output', () => {
...
@@ -201,7 +202,7 @@ describe('Issuable output', () => {
});
});
it
(
'
redirects if returned web_url has changed
'
,
(
done
)
=>
{
it
(
'
redirects if returned web_url has changed
'
,
(
done
)
=>
{
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
);
spyOn
(
urlU
tils
,
'
visitUrl
'
);
spyOn
(
vm
.
service
,
'
updateIssuable
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
)
=>
{
spyOn
(
vm
.
service
,
'
updateIssuable
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
)
=>
{
resolve
({
resolve
({
json
()
{
json
()
{
...
@@ -217,7 +218,7 @@ describe('Issuable output', () => {
...
@@ -217,7 +218,7 @@ describe('Issuable output', () => {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
expect
(
gl
.
u
tils
.
visitUrl
,
urlU
tils
.
visitUrl
,
).
toHaveBeenCalledWith
(
'
/testing-issue-move
'
);
).
toHaveBeenCalledWith
(
'
/testing-issue-move
'
);
done
();
done
();
...
@@ -270,7 +271,7 @@ describe('Issuable output', () => {
...
@@ -270,7 +271,7 @@ describe('Issuable output', () => {
describe
(
'
deleteIssuable
'
,
()
=>
{
describe
(
'
deleteIssuable
'
,
()
=>
{
it
(
'
changes URL when deleted
'
,
(
done
)
=>
{
it
(
'
changes URL when deleted
'
,
(
done
)
=>
{
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
);
spyOn
(
urlU
tils
,
'
visitUrl
'
);
spyOn
(
vm
.
service
,
'
deleteIssuable
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
)
=>
{
spyOn
(
vm
.
service
,
'
deleteIssuable
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
)
=>
{
resolve
({
resolve
({
json
()
{
json
()
{
...
@@ -283,7 +284,7 @@ describe('Issuable output', () => {
...
@@ -283,7 +284,7 @@ describe('Issuable output', () => {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
expect
(
gl
.
u
tils
.
visitUrl
,
urlU
tils
.
visitUrl
,
).
toHaveBeenCalledWith
(
'
/test
'
);
).
toHaveBeenCalledWith
(
'
/test
'
);
done
();
done
();
...
@@ -291,7 +292,7 @@ describe('Issuable output', () => {
...
@@ -291,7 +292,7 @@ describe('Issuable output', () => {
});
});
it
(
'
stops polling when deleting
'
,
(
done
)
=>
{
it
(
'
stops polling when deleting
'
,
(
done
)
=>
{
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
);
spyOn
(
urlU
tils
,
'
visitUrl
'
);
spyOn
(
vm
.
poll
,
'
stop
'
).
and
.
callThrough
();
spyOn
(
vm
.
poll
,
'
stop
'
).
and
.
callThrough
();
spyOn
(
vm
.
service
,
'
deleteIssuable
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
)
=>
{
spyOn
(
vm
.
service
,
'
deleteIssuable
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
)
=>
{
resolve
({
resolve
({
...
...
spec/javascripts/job_spec.js
View file @
e0bbadc2
import
{
bytesToKiB
}
from
'
~/lib/utils/number_utils
'
;
import
{
bytesToKiB
}
from
'
~/lib/utils/number_utils
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
'
~/lib/utils/datetime_utility
'
;
import
'
~/lib/utils/datetime_utility
'
;
import
'
~/lib/utils/url_utility
'
;
import
Job
from
'
~/job
'
;
import
Job
from
'
~/job
'
;
import
'
~/breakpoints
'
;
import
'
~/breakpoints
'
;
...
@@ -65,7 +65,7 @@ describe('Job', () => {
...
@@ -65,7 +65,7 @@ describe('Job', () => {
const
deferred2
=
$
.
Deferred
();
const
deferred2
=
$
.
Deferred
();
const
deferred3
=
$
.
Deferred
();
const
deferred3
=
$
.
Deferred
();
spyOn
(
$
,
'
ajax
'
).
and
.
returnValues
(
deferred1
.
promise
(),
deferred2
.
promise
(),
deferred3
.
promise
());
spyOn
(
$
,
'
ajax
'
).
and
.
returnValues
(
deferred1
.
promise
(),
deferred2
.
promise
(),
deferred3
.
promise
());
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
);
spyOn
(
urlU
tils
,
'
visitUrl
'
);
deferred1
.
resolve
({
deferred1
.
resolve
({
html
:
'
<span>Update<span>
'
,
html
:
'
<span>Update<span>
'
,
...
@@ -103,7 +103,7 @@ describe('Job', () => {
...
@@ -103,7 +103,7 @@ describe('Job', () => {
spyOn
(
$
,
'
ajax
'
).
and
.
returnValues
(
deferred1
.
promise
(),
deferred2
.
promise
(),
deferred3
.
promise
());
spyOn
(
$
,
'
ajax
'
).
and
.
returnValues
(
deferred1
.
promise
(),
deferred2
.
promise
(),
deferred3
.
promise
());
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
);
spyOn
(
urlU
tils
,
'
visitUrl
'
);
deferred1
.
resolve
({
deferred1
.
resolve
({
html
:
'
<span>Update<span>
'
,
html
:
'
<span>Update<span>
'
,
...
@@ -134,7 +134,7 @@ describe('Job', () => {
...
@@ -134,7 +134,7 @@ describe('Job', () => {
describe
(
'
truncated information
'
,
()
=>
{
describe
(
'
truncated information
'
,
()
=>
{
describe
(
'
when size is less than total
'
,
()
=>
{
describe
(
'
when size is less than total
'
,
()
=>
{
it
(
'
shows information about truncated log
'
,
()
=>
{
it
(
'
shows information about truncated log
'
,
()
=>
{
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
);
spyOn
(
urlU
tils
,
'
visitUrl
'
);
const
deferred
=
$
.
Deferred
();
const
deferred
=
$
.
Deferred
();
spyOn
(
$
,
'
ajax
'
).
and
.
returnValue
(
deferred
.
promise
());
spyOn
(
$
,
'
ajax
'
).
and
.
returnValue
(
deferred
.
promise
());
...
@@ -153,7 +153,7 @@ describe('Job', () => {
...
@@ -153,7 +153,7 @@ describe('Job', () => {
it
(
'
shows the size in KiB
'
,
()
=>
{
it
(
'
shows the size in KiB
'
,
()
=>
{
const
size
=
50
;
const
size
=
50
;
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
);
spyOn
(
urlU
tils
,
'
visitUrl
'
);
const
deferred
=
$
.
Deferred
();
const
deferred
=
$
.
Deferred
();
spyOn
(
$
,
'
ajax
'
).
and
.
returnValue
(
deferred
.
promise
());
spyOn
(
$
,
'
ajax
'
).
and
.
returnValue
(
deferred
.
promise
());
...
@@ -179,7 +179,7 @@ describe('Job', () => {
...
@@ -179,7 +179,7 @@ describe('Job', () => {
spyOn
(
$
,
'
ajax
'
).
and
.
returnValues
(
deferred1
.
promise
(),
deferred2
.
promise
(),
deferred3
.
promise
());
spyOn
(
$
,
'
ajax
'
).
and
.
returnValues
(
deferred1
.
promise
(),
deferred2
.
promise
(),
deferred3
.
promise
());
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
);
spyOn
(
urlU
tils
,
'
visitUrl
'
);
deferred1
.
resolve
({
deferred1
.
resolve
({
html
:
'
<span>Update</span>
'
,
html
:
'
<span>Update</span>
'
,
...
@@ -214,7 +214,7 @@ describe('Job', () => {
...
@@ -214,7 +214,7 @@ describe('Job', () => {
it
(
'
renders the raw link
'
,
()
=>
{
it
(
'
renders the raw link
'
,
()
=>
{
const
deferred
=
$
.
Deferred
();
const
deferred
=
$
.
Deferred
();
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
);
spyOn
(
urlU
tils
,
'
visitUrl
'
);
spyOn
(
$
,
'
ajax
'
).
and
.
returnValue
(
deferred
.
promise
());
spyOn
(
$
,
'
ajax
'
).
and
.
returnValue
(
deferred
.
promise
());
deferred
.
resolve
({
deferred
.
resolve
({
...
@@ -236,7 +236,7 @@ describe('Job', () => {
...
@@ -236,7 +236,7 @@ describe('Job', () => {
describe
(
'
when size is equal than total
'
,
()
=>
{
describe
(
'
when size is equal than total
'
,
()
=>
{
it
(
'
does not show the trunctated information
'
,
()
=>
{
it
(
'
does not show the trunctated information
'
,
()
=>
{
const
deferred
=
$
.
Deferred
();
const
deferred
=
$
.
Deferred
();
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
);
spyOn
(
urlU
tils
,
'
visitUrl
'
);
spyOn
(
$
,
'
ajax
'
).
and
.
returnValue
(
deferred
.
promise
());
spyOn
(
$
,
'
ajax
'
).
and
.
returnValue
(
deferred
.
promise
());
deferred
.
resolve
({
deferred
.
resolve
({
...
@@ -257,7 +257,7 @@ describe('Job', () => {
...
@@ -257,7 +257,7 @@ describe('Job', () => {
describe
(
'
output trace
'
,
()
=>
{
describe
(
'
output trace
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
const
deferred
=
$
.
Deferred
();
const
deferred
=
$
.
Deferred
();
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
);
spyOn
(
urlU
tils
,
'
visitUrl
'
);
spyOn
(
$
,
'
ajax
'
).
and
.
returnValue
(
deferred
.
promise
());
spyOn
(
$
,
'
ajax
'
).
and
.
returnValue
(
deferred
.
promise
());
deferred
.
resolve
({
deferred
.
resolve
({
...
...
spec/javascripts/merge_request_tabs_spec.js
View file @
e0bbadc2
/* eslint-disable no-var, comma-dangle, object-shorthand */
/* eslint-disable no-var, comma-dangle, object-shorthand */
/* global Notes */
/* global Notes */
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
'
~/merge_request_tabs
'
;
import
'
~/merge_request_tabs
'
;
import
'
~/commit/pipelines/pipelines_bundle
'
;
import
'
~/commit/pipelines/pipelines_bundle
'
;
import
'
~/breakpoints
'
;
import
'
~/breakpoints
'
;
...
@@ -333,7 +334,7 @@ import 'vendor/jquery.scrollTo';
...
@@ -333,7 +334,7 @@ import 'vendor/jquery.scrollTo';
describe
(
'
with note fragment hash
'
,
()
=>
{
describe
(
'
with note fragment hash
'
,
()
=>
{
it
(
'
should expand and scroll to linked fragment hash #note_xxx
'
,
function
()
{
it
(
'
should expand and scroll to linked fragment hash #note_xxx
'
,
function
()
{
spyOn
(
window
.
gl
.
u
tils
,
'
getLocationHash
'
).
and
.
returnValue
(
noteId
);
spyOn
(
urlU
tils
,
'
getLocationHash
'
).
and
.
returnValue
(
noteId
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
expect
(
noteId
.
length
).
toBeGreaterThan
(
0
);
expect
(
noteId
.
length
).
toBeGreaterThan
(
0
);
...
@@ -345,7 +346,7 @@ import 'vendor/jquery.scrollTo';
...
@@ -345,7 +346,7 @@ import 'vendor/jquery.scrollTo';
});
});
it
(
'
should gracefully ignore non-existant fragment hash
'
,
function
()
{
it
(
'
should gracefully ignore non-existant fragment hash
'
,
function
()
{
spyOn
(
window
.
gl
.
u
tils
,
'
getLocationHash
'
).
and
.
returnValue
(
'
note_something-that-does-not-exist
'
);
spyOn
(
urlU
tils
,
'
getLocationHash
'
).
and
.
returnValue
(
'
note_something-that-does-not-exist
'
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
expect
(
window
.
notes
.
toggleDiffNote
).
not
.
toHaveBeenCalled
();
expect
(
window
.
notes
.
toggleDiffNote
).
not
.
toHaveBeenCalled
();
...
@@ -354,7 +355,7 @@ import 'vendor/jquery.scrollTo';
...
@@ -354,7 +355,7 @@ import 'vendor/jquery.scrollTo';
describe
(
'
with line number fragment hash
'
,
()
=>
{
describe
(
'
with line number fragment hash
'
,
()
=>
{
it
(
'
should gracefully ignore line number fragment hash
'
,
function
()
{
it
(
'
should gracefully ignore line number fragment hash
'
,
function
()
{
spyOn
(
window
.
gl
.
u
tils
,
'
getLocationHash
'
).
and
.
returnValue
(
noteLineNumId
);
spyOn
(
urlU
tils
,
'
getLocationHash
'
).
and
.
returnValue
(
noteLineNumId
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
expect
(
noteLineNumId
.
length
).
toBeGreaterThan
(
0
);
expect
(
noteLineNumId
.
length
).
toBeGreaterThan
(
0
);
...
@@ -387,7 +388,7 @@ import 'vendor/jquery.scrollTo';
...
@@ -387,7 +388,7 @@ import 'vendor/jquery.scrollTo';
describe
(
'
with note fragment hash
'
,
()
=>
{
describe
(
'
with note fragment hash
'
,
()
=>
{
it
(
'
should expand and scroll to linked fragment hash #note_xxx
'
,
function
()
{
it
(
'
should expand and scroll to linked fragment hash #note_xxx
'
,
function
()
{
spyOn
(
window
.
gl
.
u
tils
,
'
getLocationHash
'
).
and
.
returnValue
(
noteId
);
spyOn
(
urlU
tils
,
'
getLocationHash
'
).
and
.
returnValue
(
noteId
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
...
@@ -400,7 +401,7 @@ import 'vendor/jquery.scrollTo';
...
@@ -400,7 +401,7 @@ import 'vendor/jquery.scrollTo';
});
});
it
(
'
should gracefully ignore non-existant fragment hash
'
,
function
()
{
it
(
'
should gracefully ignore non-existant fragment hash
'
,
function
()
{
spyOn
(
window
.
gl
.
u
tils
,
'
getLocationHash
'
).
and
.
returnValue
(
'
note_something-that-does-not-exist
'
);
spyOn
(
urlU
tils
,
'
getLocationHash
'
).
and
.
returnValue
(
'
note_something-that-does-not-exist
'
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
expect
(
window
.
notes
.
toggleDiffNote
).
not
.
toHaveBeenCalled
();
expect
(
window
.
notes
.
toggleDiffNote
).
not
.
toHaveBeenCalled
();
...
@@ -409,7 +410,7 @@ import 'vendor/jquery.scrollTo';
...
@@ -409,7 +410,7 @@ import 'vendor/jquery.scrollTo';
describe
(
'
with line number fragment hash
'
,
()
=>
{
describe
(
'
with line number fragment hash
'
,
()
=>
{
it
(
'
should gracefully ignore line number fragment hash
'
,
function
()
{
it
(
'
should gracefully ignore line number fragment hash
'
,
function
()
{
spyOn
(
window
.
gl
.
u
tils
,
'
getLocationHash
'
).
and
.
returnValue
(
noteLineNumId
);
spyOn
(
urlU
tils
,
'
getLocationHash
'
).
and
.
returnValue
(
noteLineNumId
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
expect
(
noteLineNumId
.
length
).
toBeGreaterThan
(
0
);
expect
(
noteLineNumId
.
length
).
toBeGreaterThan
(
0
);
...
...
spec/javascripts/notes_spec.js
View file @
e0bbadc2
/* eslint-disable space-before-function-paren, no-unused-expressions, no-var, object-shorthand, comma-dangle, max-len */
/* eslint-disable space-before-function-paren, no-unused-expressions, no-var, object-shorthand, comma-dangle, max-len */
/* global Notes */
/* global Notes */
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
'
autosize
'
;
import
'
autosize
'
;
import
'
~/gl_form
'
;
import
'
~/gl_form
'
;
import
'
~/lib/utils/text_utility
'
;
import
'
~/lib/utils/text_utility
'
;
...
@@ -168,8 +169,7 @@ import '~/notes';
...
@@ -168,8 +169,7 @@ import '~/notes';
});
});
it
(
'
sets target when hash matches
'
,
()
=>
{
it
(
'
sets target when hash matches
'
,
()
=>
{
spyOn
(
gl
.
utils
,
'
getLocationHash
'
);
spyOn
(
urlUtils
,
'
getLocationHash
'
).
and
.
returnValue
(
hash
);
gl
.
utils
.
getLocationHash
.
and
.
returnValue
(
hash
);
Notes
.
updateNoteTargetSelector
(
$note
);
Notes
.
updateNoteTargetSelector
(
$note
);
...
@@ -178,8 +178,7 @@ import '~/notes';
...
@@ -178,8 +178,7 @@ import '~/notes';
});
});
it
(
'
unsets target when hash does not match
'
,
()
=>
{
it
(
'
unsets target when hash does not match
'
,
()
=>
{
spyOn
(
gl
.
utils
,
'
getLocationHash
'
);
spyOn
(
urlUtils
,
'
getLocationHash
'
).
and
.
returnValue
(
'
note_doesnotexist
'
);
gl
.
utils
.
getLocationHash
.
and
.
returnValue
(
'
note_doesnotexist
'
);
Notes
.
updateNoteTargetSelector
(
$note
);
Notes
.
updateNoteTargetSelector
(
$note
);
...
@@ -187,8 +186,7 @@ import '~/notes';
...
@@ -187,8 +186,7 @@ import '~/notes';
});
});
it
(
'
unsets target when there is not a hash fragment anymore
'
,
()
=>
{
it
(
'
unsets target when there is not a hash fragment anymore
'
,
()
=>
{
spyOn
(
gl
.
utils
,
'
getLocationHash
'
);
spyOn
(
urlUtils
,
'
getLocationHash
'
).
and
.
returnValue
(
null
);
gl
.
utils
.
getLocationHash
.
and
.
returnValue
(
null
);
Notes
.
updateNoteTargetSelector
(
$note
);
Notes
.
updateNoteTargetSelector
(
$note
);
...
...
spec/javascripts/pager_spec.js
View file @
e0bbadc2
/* global fixture */
/* global fixture */
import
*
as
utils
from
'
~/lib/utils/url_utility
'
;
import
'
~/pager
'
;
import
'
~/pager
'
;
describe
(
'
pager
'
,
()
=>
{
describe
(
'
pager
'
,
()
=>
{
...
@@ -30,7 +31,7 @@ describe('pager', () => {
...
@@ -30,7 +31,7 @@ describe('pager', () => {
it
(
'
should use current url if data-href attribute not provided
'
,
()
=>
{
it
(
'
should use current url if data-href attribute not provided
'
,
()
=>
{
const
href
=
`
${
gl
.
TEST_HOST
}
/some_list`
;
const
href
=
`
${
gl
.
TEST_HOST
}
/some_list`
;
spyOn
(
gl
.
utils
,
'
removeParams
'
).
and
.
returnValue
(
href
);
spyOn
(
utils
,
'
removeParams
'
).
and
.
returnValue
(
href
);
Pager
.
init
();
Pager
.
init
();
expect
(
Pager
.
url
).
toBe
(
href
);
expect
(
Pager
.
url
).
toBe
(
href
);
});
});
...
@@ -44,9 +45,9 @@ describe('pager', () => {
...
@@ -44,9 +45,9 @@ describe('pager', () => {
it
(
'
keeps extra query parameters from url
'
,
()
=>
{
it
(
'
keeps extra query parameters from url
'
,
()
=>
{
window
.
history
.
replaceState
({},
null
,
'
?filter=test&offset=100
'
);
window
.
history
.
replaceState
({},
null
,
'
?filter=test&offset=100
'
);
const
href
=
`
${
gl
.
TEST_HOST
}
/some_list?filter=test`
;
const
href
=
`
${
gl
.
TEST_HOST
}
/some_list?filter=test`
;
spyOn
(
gl
.
utils
,
'
removeParams
'
).
and
.
returnValue
(
href
);
spyOn
(
utils
,
'
removeParams
'
).
and
.
returnValue
(
href
);
Pager
.
init
();
Pager
.
init
();
expect
(
gl
.
utils
.
removeParams
).
toHaveBeenCalledWith
([
'
limit
'
,
'
offset
'
]);
expect
(
utils
.
removeParams
).
toHaveBeenCalledWith
([
'
limit
'
,
'
offset
'
]);
expect
(
Pager
.
url
).
toEqual
(
href
);
expect
(
Pager
.
url
).
toEqual
(
href
);
});
});
});
});
...
...
spec/javascripts/repo/components/repo_commit_section_spec.js
View file @
e0bbadc2
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
store
from
'
~/repo/stores
'
;
import
store
from
'
~/repo/stores
'
;
import
service
from
'
~/repo/services
'
;
import
service
from
'
~/repo/services
'
;
import
repoCommitSection
from
'
~/repo/components/repo_commit_section.vue
'
;
import
repoCommitSection
from
'
~/repo/components/repo_commit_section.vue
'
;
...
@@ -97,7 +98,7 @@ describe('RepoCommitSection', () => {
...
@@ -97,7 +98,7 @@ describe('RepoCommitSection', () => {
});
});
it
(
'
redirects to MR creation page if start new MR checkbox checked
'
,
(
done
)
=>
{
it
(
'
redirects to MR creation page if start new MR checkbox checked
'
,
(
done
)
=>
{
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
);
spyOn
(
urlU
tils
,
'
visitUrl
'
);
vm
.
startNewMR
=
true
;
vm
.
startNewMR
=
true
;
vm
.
makeCommit
();
vm
.
makeCommit
();
...
@@ -105,7 +106,7 @@ describe('RepoCommitSection', () => {
...
@@ -105,7 +106,7 @@ describe('RepoCommitSection', () => {
getSetTimeoutPromise
()
getSetTimeoutPromise
()
.
then
(()
=>
Vue
.
nextTick
())
.
then
(()
=>
Vue
.
nextTick
())
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
gl
.
u
tils
.
visitUrl
).
toHaveBeenCalled
();
expect
(
urlU
tils
.
visitUrl
).
toHaveBeenCalled
();
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
...
spec/javascripts/repo/stores/actions/tree_spec.js
View file @
e0bbadc2
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
store
from
'
~/repo/stores
'
;
import
store
from
'
~/repo/stores
'
;
import
service
from
'
~/repo/services
'
;
import
service
from
'
~/repo/services
'
;
import
{
file
,
resetStore
}
from
'
../../helpers
'
;
import
{
file
,
resetStore
}
from
'
../../helpers
'
;
...
@@ -255,7 +256,7 @@ describe('Multi-file store tree actions', () => {
...
@@ -255,7 +256,7 @@ describe('Multi-file store tree actions', () => {
let
row
;
let
row
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
);
spyOn
(
urlU
tils
,
'
visitUrl
'
);
row
=
{
row
=
{
url
:
'
submoduleurl
'
,
url
:
'
submoduleurl
'
,
...
@@ -276,7 +277,7 @@ describe('Multi-file store tree actions', () => {
...
@@ -276,7 +277,7 @@ describe('Multi-file store tree actions', () => {
it
(
'
opens submodule URL
'
,
(
done
)
=>
{
it
(
'
opens submodule URL
'
,
(
done
)
=>
{
store
.
dispatch
(
'
clickedTreeRow
'
,
row
)
store
.
dispatch
(
'
clickedTreeRow
'
,
row
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
gl
.
u
tils
.
visitUrl
).
toHaveBeenCalledWith
(
'
submoduleurl
'
);
expect
(
urlU
tils
.
visitUrl
).
toHaveBeenCalledWith
(
'
submoduleurl
'
);
done
();
done
();
}).
catch
(
done
.
fail
);
}).
catch
(
done
.
fail
);
...
...
spec/javascripts/repo/stores/actions_spec.js
View file @
e0bbadc2
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
store
from
'
~/repo/stores
'
;
import
store
from
'
~/repo/stores
'
;
import
service
from
'
~/repo/services
'
;
import
service
from
'
~/repo/services
'
;
import
{
resetStore
,
file
}
from
'
../helpers
'
;
import
{
resetStore
,
file
}
from
'
../helpers
'
;
...
@@ -10,11 +11,11 @@ describe('Multi-file store actions', () => {
...
@@ -10,11 +11,11 @@ describe('Multi-file store actions', () => {
describe
(
'
redirectToUrl
'
,
()
=>
{
describe
(
'
redirectToUrl
'
,
()
=>
{
it
(
'
calls visitUrl
'
,
(
done
)
=>
{
it
(
'
calls visitUrl
'
,
(
done
)
=>
{
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
);
spyOn
(
urlU
tils
,
'
visitUrl
'
);
store
.
dispatch
(
'
redirectToUrl
'
,
'
test
'
)
store
.
dispatch
(
'
redirectToUrl
'
,
'
test
'
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
gl
.
u
tils
.
visitUrl
).
toHaveBeenCalledWith
(
'
test
'
);
expect
(
urlU
tils
.
visitUrl
).
toHaveBeenCalledWith
(
'
test
'
);
done
();
done
();
})
})
...
...
spec/javascripts/search_autocomplete_spec.js
View file @
e0bbadc2
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
'
~/gl_dropdown
'
;
import
'
~/gl_dropdown
'
;
import
'
~/search_autocomplete
'
;
import
'
~/search_autocomplete
'
;
import
'
~/lib/utils/common_utils
'
;
import
'
~/lib/utils/common_utils
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
(
function
()
{
(
function
()
{
var
assertLinks
,
dashboardIssuesPath
,
dashboardMRsPath
,
groupIssuesPath
,
groupMRsPath
,
groupName
,
mockDashboardOptions
,
mockGroupOptions
,
mockProjectOptions
,
projectIssuesPath
,
projectMRsPath
,
projectName
,
userId
,
widget
;
var
assertLinks
,
dashboardIssuesPath
,
dashboardMRsPath
,
groupIssuesPath
,
groupMRsPath
,
groupName
,
mockDashboardOptions
,
mockGroupOptions
,
mockProjectOptions
,
projectIssuesPath
,
projectMRsPath
,
projectName
,
userId
,
widget
;
...
@@ -121,7 +122,7 @@ import '~/lib/utils/common_utils';
...
@@ -121,7 +122,7 @@ import '~/lib/utils/common_utils';
loadFixtures
(
'
static/search_autocomplete.html.raw
'
);
loadFixtures
(
'
static/search_autocomplete.html.raw
'
);
// Prevent turbolinks from triggering within gl_dropdown
// Prevent turbolinks from triggering within gl_dropdown
spyOn
(
window
.
gl
.
u
tils
,
'
visitUrl
'
).
and
.
returnValue
(
true
);
spyOn
(
urlU
tils
,
'
visitUrl
'
).
and
.
returnValue
(
true
);
window
.
gon
=
{};
window
.
gon
=
{};
window
.
gon
.
current_user_id
=
userId
;
window
.
gon
.
current_user_id
=
userId
;
...
...
spec/javascripts/sidebar/sidebar_mediator_spec.js
View file @
e0bbadc2
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
SidebarMediator
from
'
~/sidebar/sidebar_mediator
'
;
import
SidebarMediator
from
'
~/sidebar/sidebar_mediator
'
;
import
SidebarStore
from
'
~/sidebar/stores/sidebar_store
'
;
import
SidebarStore
from
'
~/sidebar/stores/sidebar_store
'
;
import
SidebarService
from
'
~/sidebar/services/sidebar_service
'
;
import
SidebarService
from
'
~/sidebar/services/sidebar_service
'
;
...
@@ -85,12 +86,12 @@ describe('Sidebar mediator', () => {
...
@@ -85,12 +86,12 @@ describe('Sidebar mediator', () => {
const
moveToProjectId
=
7
;
const
moveToProjectId
=
7
;
this
.
mediator
.
store
.
setMoveToProjectId
(
moveToProjectId
);
this
.
mediator
.
store
.
setMoveToProjectId
(
moveToProjectId
);
spyOn
(
this
.
mediator
.
service
,
'
moveIssue
'
).
and
.
callThrough
();
spyOn
(
this
.
mediator
.
service
,
'
moveIssue
'
).
and
.
callThrough
();
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
);
spyOn
(
urlU
tils
,
'
visitUrl
'
);
this
.
mediator
.
moveIssue
()
this
.
mediator
.
moveIssue
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
this
.
mediator
.
service
.
moveIssue
).
toHaveBeenCalledWith
(
moveToProjectId
);
expect
(
this
.
mediator
.
service
.
moveIssue
).
toHaveBeenCalledWith
(
moveToProjectId
);
expect
(
gl
.
u
tils
.
visitUrl
).
toHaveBeenCalledWith
(
'
/root/some-project/issues/5
'
);
expect
(
urlU
tils
.
visitUrl
).
toHaveBeenCalledWith
(
'
/root/some-project/issues/5
'
);
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
...
spec/javascripts/todos_spec.js
View file @
e0bbadc2
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
Todos
from
'
~/todos
'
;
import
Todos
from
'
~/todos
'
;
import
'
~/lib/utils/common_utils
'
;
import
'
~/lib/utils/common_utils
'
;
...
@@ -16,7 +17,7 @@ describe('Todos', () => {
...
@@ -16,7 +17,7 @@ describe('Todos', () => {
it
(
'
opens the todo url
'
,
(
done
)
=>
{
it
(
'
opens the todo url
'
,
(
done
)
=>
{
const
todoLink
=
todoItem
.
dataset
.
url
;
const
todoLink
=
todoItem
.
dataset
.
url
;
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
spyOn
(
urlU
tils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
expect
(
url
).
toEqual
(
todoLink
);
expect
(
url
).
toEqual
(
todoLink
);
done
();
done
();
});
});
...
@@ -31,7 +32,7 @@ describe('Todos', () => {
...
@@ -31,7 +32,7 @@ describe('Todos', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
metakeyEvent
=
$
.
Event
(
'
click
'
,
{
keyCode
:
91
,
ctrlKey
:
true
});
metakeyEvent
=
$
.
Event
(
'
click
'
,
{
keyCode
:
91
,
ctrlKey
:
true
});
visitUrlSpy
=
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
).
and
.
callFake
(()
=>
{});
visitUrlSpy
=
spyOn
(
urlU
tils
,
'
visitUrl
'
).
and
.
callFake
(()
=>
{});
windowOpenSpy
=
spyOn
(
window
,
'
open
'
).
and
.
callFake
(()
=>
{});
windowOpenSpy
=
spyOn
(
window
,
'
open
'
).
and
.
callFake
(()
=>
{});
});
});
...
...
spec/javascripts/vue_mr_widget/components/mr_widget_deployment_spec.js
View file @
e0bbadc2
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
deploymentComponent
from
'
~/vue_merge_request_widget/components/mr_widget_deployment
'
;
import
deploymentComponent
from
'
~/vue_merge_request_widget/components/mr_widget_deployment
'
;
import
MRWidgetService
from
'
~/vue_merge_request_widget/services/mr_widget_service
'
;
import
MRWidgetService
from
'
~/vue_merge_request_widget/services/mr_widget_service
'
;
...
@@ -108,13 +109,13 @@ describe('MRWidgetDeployment', () => {
...
@@ -108,13 +109,13 @@ describe('MRWidgetDeployment', () => {
it
(
'
should show a confirm dialog and call service.stopEnvironment when confirmed
'
,
(
done
)
=>
{
it
(
'
should show a confirm dialog and call service.stopEnvironment when confirmed
'
,
(
done
)
=>
{
spyOn
(
window
,
'
confirm
'
).
and
.
returnValue
(
true
);
spyOn
(
window
,
'
confirm
'
).
and
.
returnValue
(
true
);
spyOn
(
MRWidgetService
,
'
stopEnvironment
'
).
and
.
returnValue
(
returnPromise
(
true
));
spyOn
(
MRWidgetService
,
'
stopEnvironment
'
).
and
.
returnValue
(
returnPromise
(
true
));
spyOn
(
gl
.
u
tils
,
'
visitUrl
'
).
and
.
returnValue
(
true
);
spyOn
(
urlU
tils
,
'
visitUrl
'
).
and
.
returnValue
(
true
);
vm
=
mockStopEnvironment
();
vm
=
mockStopEnvironment
();
expect
(
window
.
confirm
).
toHaveBeenCalled
();
expect
(
window
.
confirm
).
toHaveBeenCalled
();
expect
(
MRWidgetService
.
stopEnvironment
).
toHaveBeenCalledWith
(
deploymentMockData
.
stop_url
);
expect
(
MRWidgetService
.
stopEnvironment
).
toHaveBeenCalledWith
(
deploymentMockData
.
stop_url
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
gl
.
u
tils
.
visitUrl
).
toHaveBeenCalledWith
(
url
);
expect
(
urlU
tils
.
visitUrl
).
toHaveBeenCalledWith
(
url
);
done
();
done
();
},
333
);
},
333
);
});
});
...
...
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