Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
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
RecentSearchesRoot
from
'
~/filtered_search/recent_searches_root
'
;
import
*
as
vueSrc
from
'
vue
'
;
describe
(
'
RecentSearchesRoot
'
,
()
=>
{
describe
(
'
RecentSearchesRoot
'
,
()
=>
{
describe
(
'
render
'
,
()
=>
{
describe
(
'
render
'
,
()
=>
{
let
recentSearchesRoot
;
let
recentSearchesRoot
;
let
data
;
let
data
;
let
template
;
let
template
;
let
VueSpy
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
recentSearchesRoot
=
{
recentSearchesRoot
=
{
...
@@ -14,7 +14,7 @@ describe('RecentSearchesRoot', () => {
...
@@ -14,7 +14,7 @@ describe('RecentSearchesRoot', () => {
},
},
};
};
spyOn
(
vueSrc
,
'
default
'
).
and
.
callFake
((
options
)
=>
{
VueSpy
=
spyOnDependency
(
RecentSearchesRoot
,
'
Vue
'
).
and
.
callFake
((
options
)
=>
{
data
=
options
.
data
;
data
=
options
.
data
;
template
=
options
.
template
;
template
=
options
.
template
;
});
});
...
@@ -23,7 +23,7 @@ describe('RecentSearchesRoot', () => {
...
@@ -23,7 +23,7 @@ describe('RecentSearchesRoot', () => {
});
});
it
(
'
should instantiate Vue
'
,
()
=>
{
it
(
'
should instantiate Vue
'
,
()
=>
{
expect
(
vueSrc
.
default
).
toHaveBeenCalled
();
expect
(
VueSpy
).
toHaveBeenCalled
();
expect
(
data
()).
toBe
(
recentSearchesRoot
.
store
.
state
);
expect
(
data
()).
toBe
(
recentSearchesRoot
.
store
.
state
);
expect
(
template
).
toContain
(
'
:is-local-storage-available="isLocalStorageAvailable"
'
);
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
store
from
'
~/ide/stores
'
;
import
*
as
actions
from
'
~/ide/stores/actions
'
;
import
*
as
types
from
'
~/ide/stores/mutation_types
'
;
import
*
as
types
from
'
~/ide/stores/mutation_types
'
;
import
router
from
'
~/ide/ide_router
'
;
import
router
from
'
~/ide/ide_router
'
;
import
{
resetStore
,
file
}
from
'
../helpers
'
;
import
{
resetStore
,
file
}
from
'
../helpers
'
;
...
@@ -17,12 +16,12 @@ describe('Multi-file store actions', () => {
...
@@ -17,12 +16,12 @@ describe('Multi-file store actions', () => {
describe
(
'
redirectToUrl
'
,
()
=>
{
describe
(
'
redirectToUrl
'
,
()
=>
{
it
(
'
calls visitUrl
'
,
done
=>
{
it
(
'
calls visitUrl
'
,
done
=>
{
spyOn
(
urlUtil
s
,
'
visitUrl
'
);
const
visitUrl
=
spyOnDependency
(
action
s
,
'
visitUrl
'
);
store
store
.
dispatch
(
'
redirectToUrl
'
,
'
test
'
)
.
dispatch
(
'
redirectToUrl
'
,
'
test
'
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
urlUtils
.
visitUrl
).
toHaveBeenCalledWith
(
'
test
'
);
expect
(
visitUrl
).
toHaveBeenCalledWith
(
'
test
'
);
done
();
done
();
})
})
...
@@ -298,7 +297,7 @@ describe('Multi-file store actions', () => {
...
@@ -298,7 +297,7 @@ describe('Multi-file store actions', () => {
store
.
state
.
changedFiles
.
push
(
file
(),
file
(
'
new
'
));
store
.
state
.
changedFiles
.
push
(
file
(),
file
(
'
new
'
));
testAction
(
testAction
(
actions
.
stageAllChanges
,
stageAllChanges
,
null
,
null
,
store
.
state
,
store
.
state
,
[
[
...
@@ -316,7 +315,7 @@ describe('Multi-file store actions', () => {
...
@@ -316,7 +315,7 @@ describe('Multi-file store actions', () => {
store
.
state
.
stagedFiles
.
push
(
file
(),
file
(
'
new
'
));
store
.
state
.
stagedFiles
.
push
(
file
(),
file
(
'
new
'
));
testAction
(
testAction
(
actions
.
unstageAllChanges
,
unstageAllChanges
,
null
,
null
,
store
.
state
,
store
.
state
,
[
[
...
...
spec/javascripts/job_spec.js
View file @
704e8661
...
@@ -2,7 +2,6 @@ import $ from 'jquery';
...
@@ -2,7 +2,6 @@ import $ from 'jquery';
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
numberToHumanSize
}
from
'
~/lib/utils/number_utils
'
;
import
{
numberToHumanSize
}
from
'
~/lib/utils/number_utils
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
'
~/lib/utils/datetime_utility
'
;
import
'
~/lib/utils/datetime_utility
'
;
import
Job
from
'
~/job
'
;
import
Job
from
'
~/job
'
;
import
'
~/breakpoints
'
;
import
'
~/breakpoints
'
;
...
@@ -22,7 +21,7 @@ describe('Job', () => {
...
@@ -22,7 +21,7 @@ describe('Job', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
loadFixtures
(
'
builds/build-with-artifacts.html.raw
'
);
loadFixtures
(
'
builds/build-with-artifacts.html.raw
'
);
spyOn
(
urlUtils
,
'
visitUrl
'
);
spyOn
Dependency
(
Job
,
'
visitUrl
'
);
response
=
{};
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
(
'
imageUtility
'
,
()
=>
{
describe
(
'
isImageLoaded
'
,
()
=>
{
describe
(
'
isImageLoaded
'
,
()
=>
{
...
@@ -8,7 +8,7 @@ describe('imageUtility', () => {
...
@@ -8,7 +8,7 @@ describe('imageUtility', () => {
naturalHeight
:
100
,
naturalHeight
:
100
,
};
};
expect
(
i
mageUtility
.
i
sImageLoaded
(
element
)).
toEqual
(
false
);
expect
(
isImageLoaded
(
element
)).
toEqual
(
false
);
});
});
it
(
'
should return false when naturalHeight = 0
'
,
()
=>
{
it
(
'
should return false when naturalHeight = 0
'
,
()
=>
{
...
@@ -17,7 +17,7 @@ describe('imageUtility', () => {
...
@@ -17,7 +17,7 @@ describe('imageUtility', () => {
naturalHeight
:
0
,
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
'
,
()
=>
{
it
(
'
should return true when image.complete and naturalHeight != 0
'
,
()
=>
{
...
@@ -26,7 +26,7 @@ describe('imageUtility', () => {
...
@@ -26,7 +26,7 @@ describe('imageUtility', () => {
naturalHeight
:
100
,
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 @@
...
@@ -3,7 +3,6 @@
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
MergeRequestTabs
from
'
~/merge_request_tabs
'
;
import
MergeRequestTabs
from
'
~/merge_request_tabs
'
;
import
'
~/commit/pipelines/pipelines_bundle
'
;
import
'
~/commit/pipelines/pipelines_bundle
'
;
import
'
~/breakpoints
'
;
import
'
~/breakpoints
'
;
...
@@ -356,7 +355,7 @@ import 'vendor/jquery.scrollTo';
...
@@ -356,7 +355,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
(
done
)
{
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
'
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -372,7 +371,7 @@ import 'vendor/jquery.scrollTo';
...
@@ -372,7 +371,7 @@ import 'vendor/jquery.scrollTo';
});
});
it
(
'
should gracefully ignore non-existant fragment hash
'
,
function
(
done
)
{
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
'
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -385,7 +384,7 @@ import 'vendor/jquery.scrollTo';
...
@@ -385,7 +384,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
(
urlUtil
s
,
'
getLocationHash
'
).
and
.
returnValue
(
noteLineNumId
);
spyOn
Dependency
(
MergeRequestTab
s
,
'
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
);
...
@@ -422,7 +421,7 @@ import 'vendor/jquery.scrollTo';
...
@@ -422,7 +421,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
(
done
)
{
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
'
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
...
@@ -439,7 +438,7 @@ import 'vendor/jquery.scrollTo';
...
@@ -439,7 +438,7 @@ import 'vendor/jquery.scrollTo';
});
});
it
(
'
should gracefully ignore non-existant fragment hash
'
,
function
(
done
)
{
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
'
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -451,7 +450,7 @@ import 'vendor/jquery.scrollTo';
...
@@ -451,7 +450,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
(
urlUtil
s
,
'
getLocationHash
'
).
and
.
returnValue
(
noteLineNumId
);
spyOn
Dependency
(
MergeRequestTab
s
,
'
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 @
704e8661
...
@@ -3,7 +3,6 @@ import $ from 'jquery';
...
@@ -3,7 +3,6 @@ import $ from 'jquery';
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
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
'
;
...
@@ -222,7 +221,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper';
...
@@ -222,7 +221,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper';
});
});
it
(
'
sets target when hash matches
'
,
()
=>
{
it
(
'
sets target when hash matches
'
,
()
=>
{
spyOn
(
urlUtil
s
,
'
getLocationHash
'
).
and
.
returnValue
(
hash
);
spyOn
Dependency
(
Note
s
,
'
getLocationHash
'
).
and
.
returnValue
(
hash
);
Notes
.
updateNoteTargetSelector
(
$note
);
Notes
.
updateNoteTargetSelector
(
$note
);
...
@@ -231,7 +230,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper';
...
@@ -231,7 +230,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper';
});
});
it
(
'
unsets target when hash does not match
'
,
()
=>
{
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
);
Notes
.
updateNoteTargetSelector
(
$note
);
...
@@ -239,7 +238,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper';
...
@@ -239,7 +238,7 @@ import timeoutPromise from './helpers/set_timeout_promise_helper';
});
});
it
(
'
unsets target when there is not a hash fragment anymore
'
,
()
=>
{
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
);
Notes
.
updateNoteTargetSelector
(
$note
);
...
...
spec/javascripts/pager_spec.js
View file @
704e8661
/* global fixture */
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
*
as
utils
from
'
~/lib/utils/url_utility
'
;
import
Pager
from
'
~/pager
'
;
import
Pager
from
'
~/pager
'
;
describe
(
'
pager
'
,
()
=>
{
describe
(
'
pager
'
,
()
=>
{
...
@@ -25,7 +23,7 @@ describe('pager', () => {
...
@@ -25,7 +23,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
(
utils
,
'
removeParams
'
).
and
.
returnValue
(
href
);
spyOn
Dependency
(
Pager
,
'
removeParams
'
).
and
.
returnValue
(
href
);
Pager
.
init
();
Pager
.
init
();
expect
(
Pager
.
url
).
toBe
(
href
);
expect
(
Pager
.
url
).
toBe
(
href
);
});
});
...
@@ -39,9 +37,9 @@ describe('pager', () => {
...
@@ -39,9 +37,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
(
utils
,
'
removeParams
'
).
and
.
returnValue
(
href
);
const
removeParams
=
spyOnDependency
(
Pager
,
'
removeParams
'
).
and
.
returnValue
(
href
);
Pager
.
init
();
Pager
.
init
();
expect
(
utils
.
removeParams
).
toHaveBeenCalledWith
([
'
limit
'
,
'
offset
'
]);
expect
(
removeParams
).
toHaveBeenCalledWith
([
'
limit
'
,
'
offset
'
]);
expect
(
Pager
.
url
).
toEqual
(
href
);
expect
(
Pager
.
url
).
toEqual
(
href
);
});
});
});
});
...
...
spec/javascripts/search_autocomplete_spec.js
View file @
704e8661
...
@@ -4,7 +4,6 @@ import $ from 'jquery';
...
@@ -4,7 +4,6 @@ import $ from 'jquery';
import
'
~/gl_dropdown
'
;
import
'
~/gl_dropdown
'
;
import
SearchAutocomplete
from
'
~/search_autocomplete
'
;
import
SearchAutocomplete
from
'
~/search_autocomplete
'
;
import
'
~/lib/utils/common_utils
'
;
import
'
~/lib/utils/common_utils
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
describe
(
'
Search autocomplete dropdown
'
,
()
=>
{
describe
(
'
Search autocomplete dropdown
'
,
()
=>
{
var
assertLinks
,
var
assertLinks
,
...
@@ -129,9 +128,6 @@ describe('Search autocomplete dropdown', () => {
...
@@ -129,9 +128,6 @@ describe('Search autocomplete dropdown', () => {
beforeEach
(
function
()
{
beforeEach
(
function
()
{
loadFixtures
(
'
static/search_autocomplete.html.raw
'
);
loadFixtures
(
'
static/search_autocomplete.html.raw
'
);
// Prevent turbolinks from triggering within gl_dropdown
spyOn
(
urlUtils
,
'
visitUrl
'
).
and
.
returnValue
(
true
);
window
.
gon
=
{};
window
.
gon
=
{};
window
.
gon
.
current_user_id
=
userId
;
window
.
gon
.
current_user_id
=
userId
;
window
.
gon
.
current_username
=
userName
;
window
.
gon
.
current_username
=
userName
;
...
...
spec/javascripts/sidebar/sidebar_mediator_spec.js
View file @
704e8661
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
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
'
;
import
Mock
from
'
./mock_data
'
;
import
Mock
from
'
./mock_data
'
;
describe
(
'
Sidebar mediator
'
,
()
=>
{
describe
(
'
Sidebar mediator
'
,
function
()
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
Vue
.
http
.
interceptors
.
push
(
Mock
.
sidebarMockInterceptor
);
Vue
.
http
.
interceptors
.
push
(
Mock
.
sidebarMockInterceptor
);
this
.
mediator
=
new
SidebarMediator
(
Mock
.
mediator
);
this
.
mediator
=
new
SidebarMediator
(
Mock
.
mediator
);
...
@@ -87,12 +86,12 @@ describe('Sidebar mediator', () => {
...
@@ -87,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
(
urlUtils
,
'
visitUrl
'
);
const
visitUrl
=
spyOnDependency
(
SidebarMediator
,
'
visitUrl
'
);
this
.
mediator
.
moveIssue
()
this
.
mediator
.
moveIssue
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
this
.
mediator
.
service
.
moveIssue
).
toHaveBeenCalledWith
(
moveToProjectId
);
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
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
...
spec/javascripts/todos_spec.js
View file @
704e8661
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
Todos
from
'
~/pages/dashboard/todos/index/todos
'
;
import
Todos
from
'
~/pages/dashboard/todos/index/todos
'
;
import
'
~/lib/utils/common_utils
'
;
import
'
~/lib/utils/common_utils
'
;
...
@@ -18,7 +17,7 @@ describe('Todos', () => {
...
@@ -18,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
(
urlUtil
s
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
spyOn
Dependency
(
Todo
s
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
expect
(
url
).
toEqual
(
todoLink
);
expect
(
url
).
toEqual
(
todoLink
);
done
();
done
();
});
});
...
@@ -33,7 +32,7 @@ describe('Todos', () => {
...
@@ -33,7 +32,7 @@ describe('Todos', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
metakeyEvent
=
$
.
Event
(
'
click
'
,
{
keyCode
:
91
,
ctrlKey
:
true
});
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
(()
=>
{});
windowOpenSpy
=
spyOn
(
window
,
'
open
'
).
and
.
callFake
(()
=>
{});
});
});
...
...
spec/javascripts/vue_mr_widget/components/deployment_spec.js
View file @
704e8661
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
deploymentComponent
from
'
~/vue_merge_request_widget/components/deployment.vue
'
;
import
deploymentComponent
from
'
~/vue_merge_request_widget/components/deployment.vue
'
;
import
MRWidgetService
from
'
~/vue_merge_request_widget/services/mr_widget_service
'
;
import
MRWidgetService
from
'
~/vue_merge_request_widget/services/mr_widget_service
'
;
import
{
getTimeago
}
from
'
~/lib/utils/datetime_utility
'
;
import
{
getTimeago
}
from
'
~/lib/utils/datetime_utility
'
;
...
@@ -117,13 +116,13 @@ describe('Deployment component', () => {
...
@@ -117,13 +116,13 @@ describe('Deployment component', () => {
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
(
urlUtils
,
'
visitUrl
'
).
and
.
returnValue
(
true
);
const
visitUrl
=
spyOnDependency
(
deploymentComponent
,
'
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
(
urlUtils
.
visitUrl
).
toHaveBeenCalledWith
(
url
);
expect
(
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