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
704e8661
Commit
704e8661
authored
Apr 13, 2018
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix more instances of "import *" with spyOnDependency
parent
1f1af49a
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
32 additions
and
45 deletions
+32
-45
spec/javascripts/filtered_search/recent_searches_root_spec.js
.../javascripts/filtered_search/recent_searches_root_spec.js
+3
-3
spec/javascripts/ide/stores/actions_spec.js
spec/javascripts/ide/stores/actions_spec.js
+5
-6
spec/javascripts/job_spec.js
spec/javascripts/job_spec.js
+1
-2
spec/javascripts/lib/utils/image_utility_spec.js
spec/javascripts/lib/utils/image_utility_spec.js
+4
-4
spec/javascripts/merge_request_tabs_spec.js
spec/javascripts/merge_request_tabs_spec.js
+6
-7
spec/javascripts/notes_spec.js
spec/javascripts/notes_spec.js
+3
-4
spec/javascripts/pager_spec.js
spec/javascripts/pager_spec.js
+3
-5
spec/javascripts/search_autocomplete_spec.js
spec/javascripts/search_autocomplete_spec.js
+0
-4
spec/javascripts/sidebar/sidebar_mediator_spec.js
spec/javascripts/sidebar/sidebar_mediator_spec.js
+3
-4
spec/javascripts/todos_spec.js
spec/javascripts/todos_spec.js
+2
-3
spec/javascripts/vue_mr_widget/components/deployment_spec.js
spec/javascripts/vue_mr_widget/components/deployment_spec.js
+2
-3
No files found.
spec/javascripts/filtered_search/recent_searches_root_spec.js
View file @
704e8661
import
RecentSearchesRoot
from
'
~/filtered_search/recent_searches_root
'
;
import
*
as
vueSrc
from
'
vue
'
;
describe
(
'
RecentSearchesRoot
'
,
()
=>
{
describe
(
'
render
'
,
()
=>
{
let
recentSearchesRoot
;
let
data
;
let
template
;
let
VueSpy
;
beforeEach
(()
=>
{
recentSearchesRoot
=
{
...
...
@@ -14,7 +14,7 @@ describe('RecentSearchesRoot', () => {
},
};
spyOn
(
vueSrc
,
'
default
'
).
and
.
callFake
((
options
)
=>
{
VueSpy
=
spyOnDependency
(
RecentSearchesRoot
,
'
Vue
'
).
and
.
callFake
((
options
)
=>
{
data
=
options
.
data
;
template
=
options
.
template
;
});
...
...
@@ -23,7 +23,7 @@ describe('RecentSearchesRoot', () => {
});
it
(
'
should instantiate Vue
'
,
()
=>
{
expect
(
vueSrc
.
default
).
toHaveBeenCalled
();
expect
(
VueSpy
).
toHaveBeenCalled
();
expect
(
data
()).
toBe
(
recentSearchesRoot
.
store
.
state
);
expect
(
template
).
toContain
(
'
:is-local-storage-available="isLocalStorageAvailable"
'
);
});
...
...
spec/javascripts/ide/stores/actions_spec.js
View file @
704e8661
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
actions
,
{
stageAllChanges
,
unstageAllChanges
}
from
'
~/ide/stores/actions
'
;
import
store
from
'
~/ide/stores
'
;
import
*
as
actions
from
'
~/ide/stores/actions
'
;
import
*
as
types
from
'
~/ide/stores/mutation_types
'
;
import
router
from
'
~/ide/ide_router
'
;
import
{
resetStore
,
file
}
from
'
../helpers
'
;
...
...
@@ -17,12 +16,12 @@ describe('Multi-file store actions', () => {
describe
(
'
redirectToUrl
'
,
()
=>
{
it
(
'
calls visitUrl
'
,
done
=>
{
spyOn
(
urlUtil
s
,
'
visitUrl
'
);
const
visitUrl
=
spyOnDependency
(
action
s
,
'
visitUrl
'
);
store
.
dispatch
(
'
redirectToUrl
'
,
'
test
'
)
.
then
(()
=>
{
expect
(
urlUtils
.
visitUrl
).
toHaveBeenCalledWith
(
'
test
'
);
expect
(
visitUrl
).
toHaveBeenCalledWith
(
'
test
'
);
done
();
})
...
...
@@ -298,7 +297,7 @@ describe('Multi-file store actions', () => {
store
.
state
.
changedFiles
.
push
(
file
(),
file
(
'
new
'
));
testAction
(
actions
.
stageAllChanges
,
stageAllChanges
,
null
,
store
.
state
,
[
...
...
@@ -316,7 +315,7 @@ describe('Multi-file store actions', () => {
store
.
state
.
stagedFiles
.
push
(
file
(),
file
(
'
new
'
));
testAction
(
actions
.
unstageAllChanges
,
unstageAllChanges
,
null
,
store
.
state
,
[
...
...
spec/javascripts/job_spec.js
View file @
704e8661
...
...
@@ -2,7 +2,6 @@ import $ from 'jquery';
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
numberToHumanSize
}
from
'
~/lib/utils/number_utils
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
'
~/lib/utils/datetime_utility
'
;
import
Job
from
'
~/job
'
;
import
'
~/breakpoints
'
;
...
...
@@ -22,7 +21,7 @@ describe('Job', () => {
beforeEach
(()
=>
{
loadFixtures
(
'
builds/build-with-artifacts.html.raw
'
);
spyOn
(
urlUtils
,
'
visitUrl
'
);
spyOn
Dependency
(
Job
,
'
visitUrl
'
);
response
=
{};
...
...
spec/javascripts/lib/utils/image_utility_spec.js
View file @
704e8661
import
*
as
imageUtility
from
'
~/lib/utils/image_utility
'
;
import
{
isImageLoaded
}
from
'
~/lib/utils/image_utility
'
;
describe
(
'
imageUtility
'
,
()
=>
{
describe
(
'
isImageLoaded
'
,
()
=>
{
...
...
@@ -8,7 +8,7 @@ describe('imageUtility', () => {
naturalHeight
:
100
,
};
expect
(
i
mageUtility
.
i
sImageLoaded
(
element
)).
toEqual
(
false
);
expect
(
isImageLoaded
(
element
)).
toEqual
(
false
);
});
it
(
'
should return false when naturalHeight = 0
'
,
()
=>
{
...
...
@@ -17,7 +17,7 @@ describe('imageUtility', () => {
naturalHeight
:
0
,
};
expect
(
i
mageUtility
.
i
sImageLoaded
(
element
)).
toEqual
(
false
);
expect
(
isImageLoaded
(
element
)).
toEqual
(
false
);
});
it
(
'
should return true when image.complete and naturalHeight != 0
'
,
()
=>
{
...
...
@@ -26,7 +26,7 @@ describe('imageUtility', () => {
naturalHeight
:
100
,
};
expect
(
i
mageUtility
.
i
sImageLoaded
(
element
)).
toEqual
(
true
);
expect
(
isImageLoaded
(
element
)).
toEqual
(
true
);
});
});
});
spec/javascripts/merge_request_tabs_spec.js
View file @
704e8661
...
...
@@ -3,7 +3,6 @@
import
$
from
'
jquery
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
MergeRequestTabs
from
'
~/merge_request_tabs
'
;
import
'
~/commit/pipelines/pipelines_bundle
'
;
import
'
~/breakpoints
'
;
...
...
@@ -356,7 +355,7 @@ import 'vendor/jquery.scrollTo';
describe
(
'
with note fragment hash
'
,
()
=>
{
it
(
'
should expand and scroll to linked fragment hash #note_xxx
'
,
function
(
done
)
{
spyOn
(
urlUtil
s
,
'
getLocationHash
'
).
and
.
returnValue
(
noteId
);
spyOn
Dependency
(
MergeRequestTab
s
,
'
getLocationHash
'
).
and
.
returnValue
(
noteId
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
setTimeout
(()
=>
{
...
...
@@ -372,7 +371,7 @@ import 'vendor/jquery.scrollTo';
});
it
(
'
should gracefully ignore non-existant fragment hash
'
,
function
(
done
)
{
spyOn
(
urlUtil
s
,
'
getLocationHash
'
).
and
.
returnValue
(
'
note_something-that-does-not-exist
'
);
spyOn
Dependency
(
MergeRequestTab
s
,
'
getLocationHash
'
).
and
.
returnValue
(
'
note_something-that-does-not-exist
'
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
setTimeout
(()
=>
{
...
...
@@ -385,7 +384,7 @@ import 'vendor/jquery.scrollTo';
describe
(
'
with line number fragment hash
'
,
()
=>
{
it
(
'
should gracefully ignore line number fragment hash
'
,
function
()
{
spyOn
(
urlUtil
s
,
'
getLocationHash
'
).
and
.
returnValue
(
noteLineNumId
);
spyOn
Dependency
(
MergeRequestTab
s
,
'
getLocationHash
'
).
and
.
returnValue
(
noteLineNumId
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
expect
(
noteLineNumId
.
length
).
toBeGreaterThan
(
0
);
...
...
@@ -422,7 +421,7 @@ import 'vendor/jquery.scrollTo';
describe
(
'
with note fragment hash
'
,
()
=>
{
it
(
'
should expand and scroll to linked fragment hash #note_xxx
'
,
function
(
done
)
{
spyOn
(
urlUtil
s
,
'
getLocationHash
'
).
and
.
returnValue
(
noteId
);
spyOn
Dependency
(
MergeRequestTab
s
,
'
getLocationHash
'
).
and
.
returnValue
(
noteId
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
...
...
@@ -439,7 +438,7 @@ import 'vendor/jquery.scrollTo';
});
it
(
'
should gracefully ignore non-existant fragment hash
'
,
function
(
done
)
{
spyOn
(
urlUtil
s
,
'
getLocationHash
'
).
and
.
returnValue
(
'
note_something-that-does-not-exist
'
);
spyOn
Dependency
(
MergeRequestTab
s
,
'
getLocationHash
'
).
and
.
returnValue
(
'
note_something-that-does-not-exist
'
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
setTimeout
(()
=>
{
...
...
@@ -451,7 +450,7 @@ import 'vendor/jquery.scrollTo';
describe
(
'
with line number fragment hash
'
,
()
=>
{
it
(
'
should gracefully ignore line number fragment hash
'
,
function
()
{
spyOn
(
urlUtil
s
,
'
getLocationHash
'
).
and
.
returnValue
(
noteLineNumId
);
spyOn
Dependency
(
MergeRequestTab
s
,
'
getLocationHash
'
).
and
.
returnValue
(
noteLineNumId
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
expect
(
noteLineNumId
.
length
).
toBeGreaterThan
(
0
);
...
...
spec/javascripts/notes_spec.js
View file @
704e8661
...
...
@@ -3,7 +3,6 @@ import $ from 'jquery';
import
_
from
'
underscore
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
'
autosize
'
;
import
'
~/gl_form
'
;
import
'
~/lib/utils/text_utility
'
;
...
...
@@ -222,7 +221,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper';
});
it
(
'
sets target when hash matches
'
,
()
=>
{
spyOn
(
urlUtil
s
,
'
getLocationHash
'
).
and
.
returnValue
(
hash
);
spyOn
Dependency
(
Note
s
,
'
getLocationHash
'
).
and
.
returnValue
(
hash
);
Notes
.
updateNoteTargetSelector
(
$note
);
...
...
@@ -231,7 +230,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper';
});
it
(
'
unsets target when hash does not match
'
,
()
=>
{
spyOn
(
urlUtil
s
,
'
getLocationHash
'
).
and
.
returnValue
(
'
note_doesnotexist
'
);
spyOn
Dependency
(
Note
s
,
'
getLocationHash
'
).
and
.
returnValue
(
'
note_doesnotexist
'
);
Notes
.
updateNoteTargetSelector
(
$note
);
...
...
@@ -239,7 +238,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper';
});
it
(
'
unsets target when there is not a hash fragment anymore
'
,
()
=>
{
spyOn
(
urlUtil
s
,
'
getLocationHash
'
).
and
.
returnValue
(
null
);
spyOn
Dependency
(
Note
s
,
'
getLocationHash
'
).
and
.
returnValue
(
null
);
Notes
.
updateNoteTargetSelector
(
$note
);
...
...
spec/javascripts/pager_spec.js
View file @
704e8661
/* global fixture */
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
*
as
utils
from
'
~/lib/utils/url_utility
'
;
import
Pager
from
'
~/pager
'
;
describe
(
'
pager
'
,
()
=>
{
...
...
@@ -25,7 +23,7 @@ describe('pager', () => {
it
(
'
should use current url if data-href attribute not provided
'
,
()
=>
{
const
href
=
`
${
gl
.
TEST_HOST
}
/some_list`
;
spyOn
(
utils
,
'
removeParams
'
).
and
.
returnValue
(
href
);
spyOn
Dependency
(
Pager
,
'
removeParams
'
).
and
.
returnValue
(
href
);
Pager
.
init
();
expect
(
Pager
.
url
).
toBe
(
href
);
});
...
...
@@ -39,9 +37,9 @@ describe('pager', () => {
it
(
'
keeps extra query parameters from url
'
,
()
=>
{
window
.
history
.
replaceState
({},
null
,
'
?filter=test&offset=100
'
);
const
href
=
`
${
gl
.
TEST_HOST
}
/some_list?filter=test`
;
spyOn
(
utils
,
'
removeParams
'
).
and
.
returnValue
(
href
);
const
removeParams
=
spyOnDependency
(
Pager
,
'
removeParams
'
).
and
.
returnValue
(
href
);
Pager
.
init
();
expect
(
utils
.
removeParams
).
toHaveBeenCalledWith
([
'
limit
'
,
'
offset
'
]);
expect
(
removeParams
).
toHaveBeenCalledWith
([
'
limit
'
,
'
offset
'
]);
expect
(
Pager
.
url
).
toEqual
(
href
);
});
});
...
...
spec/javascripts/search_autocomplete_spec.js
View file @
704e8661
...
...
@@ -4,7 +4,6 @@ import $ from 'jquery';
import
'
~/gl_dropdown
'
;
import
SearchAutocomplete
from
'
~/search_autocomplete
'
;
import
'
~/lib/utils/common_utils
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
describe
(
'
Search autocomplete dropdown
'
,
()
=>
{
var
assertLinks
,
...
...
@@ -129,9 +128,6 @@ describe('Search autocomplete dropdown', () => {
beforeEach
(
function
()
{
loadFixtures
(
'
static/search_autocomplete.html.raw
'
);
// Prevent turbolinks from triggering within gl_dropdown
spyOn
(
urlUtils
,
'
visitUrl
'
).
and
.
returnValue
(
true
);
window
.
gon
=
{};
window
.
gon
.
current_user_id
=
userId
;
window
.
gon
.
current_username
=
userName
;
...
...
spec/javascripts/sidebar/sidebar_mediator_spec.js
View file @
704e8661
import
_
from
'
underscore
'
;
import
Vue
from
'
vue
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
SidebarMediator
from
'
~/sidebar/sidebar_mediator
'
;
import
SidebarStore
from
'
~/sidebar/stores/sidebar_store
'
;
import
SidebarService
from
'
~/sidebar/services/sidebar_service
'
;
import
Mock
from
'
./mock_data
'
;
describe
(
'
Sidebar mediator
'
,
()
=>
{
describe
(
'
Sidebar mediator
'
,
function
()
{
beforeEach
(()
=>
{
Vue
.
http
.
interceptors
.
push
(
Mock
.
sidebarMockInterceptor
);
this
.
mediator
=
new
SidebarMediator
(
Mock
.
mediator
);
...
...
@@ -87,12 +86,12 @@ describe('Sidebar mediator', () => {
const
moveToProjectId
=
7
;
this
.
mediator
.
store
.
setMoveToProjectId
(
moveToProjectId
);
spyOn
(
this
.
mediator
.
service
,
'
moveIssue
'
).
and
.
callThrough
();
spyOn
(
urlUtils
,
'
visitUrl
'
);
const
visitUrl
=
spyOnDependency
(
SidebarMediator
,
'
visitUrl
'
);
this
.
mediator
.
moveIssue
()
.
then
(()
=>
{
expect
(
this
.
mediator
.
service
.
moveIssue
).
toHaveBeenCalledWith
(
moveToProjectId
);
expect
(
urlUtils
.
visitUrl
).
toHaveBeenCalledWith
(
'
/root/some-project/issues/5
'
);
expect
(
visitUrl
).
toHaveBeenCalledWith
(
'
/root/some-project/issues/5
'
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
...
...
spec/javascripts/todos_spec.js
View file @
704e8661
import
$
from
'
jquery
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
Todos
from
'
~/pages/dashboard/todos/index/todos
'
;
import
'
~/lib/utils/common_utils
'
;
...
...
@@ -18,7 +17,7 @@ describe('Todos', () => {
it
(
'
opens the todo url
'
,
(
done
)
=>
{
const
todoLink
=
todoItem
.
dataset
.
url
;
spyOn
(
urlUtil
s
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
spyOn
Dependency
(
Todo
s
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
expect
(
url
).
toEqual
(
todoLink
);
done
();
});
...
...
@@ -33,7 +32,7 @@ describe('Todos', () => {
beforeEach
(()
=>
{
metakeyEvent
=
$
.
Event
(
'
click
'
,
{
keyCode
:
91
,
ctrlKey
:
true
});
visitUrlSpy
=
spyOn
(
urlUtil
s
,
'
visitUrl
'
).
and
.
callFake
(()
=>
{});
visitUrlSpy
=
spyOn
Dependency
(
Todo
s
,
'
visitUrl
'
).
and
.
callFake
(()
=>
{});
windowOpenSpy
=
spyOn
(
window
,
'
open
'
).
and
.
callFake
(()
=>
{});
});
...
...
spec/javascripts/vue_mr_widget/components/deployment_spec.js
View file @
704e8661
import
Vue
from
'
vue
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
deploymentComponent
from
'
~/vue_merge_request_widget/components/deployment.vue
'
;
import
MRWidgetService
from
'
~/vue_merge_request_widget/services/mr_widget_service
'
;
import
{
getTimeago
}
from
'
~/lib/utils/datetime_utility
'
;
...
...
@@ -117,13 +116,13 @@ describe('Deployment component', () => {
it
(
'
should show a confirm dialog and call service.stopEnvironment when confirmed
'
,
(
done
)
=>
{
spyOn
(
window
,
'
confirm
'
).
and
.
returnValue
(
true
);
spyOn
(
MRWidgetService
,
'
stopEnvironment
'
).
and
.
returnValue
(
returnPromise
(
true
));
spyOn
(
urlUtils
,
'
visitUrl
'
).
and
.
returnValue
(
true
);
const
visitUrl
=
spyOnDependency
(
deploymentComponent
,
'
visitUrl
'
).
and
.
returnValue
(
true
);
vm
=
mockStopEnvironment
();
expect
(
window
.
confirm
).
toHaveBeenCalled
();
expect
(
MRWidgetService
.
stopEnvironment
).
toHaveBeenCalledWith
(
deploymentMockData
.
stop_url
);
setTimeout
(()
=>
{
expect
(
urlUtils
.
visitUrl
).
toHaveBeenCalledWith
(
url
);
expect
(
visitUrl
).
toHaveBeenCalledWith
(
url
);
done
();
},
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