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
1f1af49a
Commit
1f1af49a
authored
Apr 13, 2018
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tests in filtered_search_manager_spec.js
parent
00fc61cf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
spec/javascripts/filtered_search/filtered_search_manager_spec.js
...vascripts/filtered_search/filtered_search_manager_spec.js
+7
-8
No files found.
spec/javascripts/filtered_search/filtered_search_manager_spec.js
View file @
1f1af49a
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
*
as
recentSearchesStoreSrc
from
'
~/filtered_search/stores/recent_searches_store
'
;
import
RecentSearchesService
from
'
~/filtered_search/services/recent_searches_service
'
;
import
RecentSearchesServiceError
from
'
~/filtered_search/services/recent_searches_service_error
'
;
import
RecentSearchesRoot
from
'
~/filtered_search/recent_searches_root
'
;
...
...
@@ -74,18 +72,19 @@ describe('Filtered Search Manager', () => {
describe
(
'
class constructor
'
,
()
=>
{
const
isLocalStorageAvailable
=
'
isLocalStorageAvailable
'
;
let
RecentSearchesStoreSpy
;
beforeEach
(()
=>
{
spyOn
(
RecentSearchesService
,
'
isAvailable
'
).
and
.
returnValue
(
isLocalStorageAvailable
);
spyOn
(
recentSearchesStoreSrc
,
'
default
'
);
spyOn
(
RecentSearchesRoot
.
prototype
,
'
render
'
);
RecentSearchesStoreSpy
=
spyOnDependency
(
FilteredSearchManager
,
'
RecentSearchesStore
'
);
});
it
(
'
should instantiate RecentSearchesStore with isLocalStorageAvailable
'
,
()
=>
{
manager
=
new
FilteredSearchManager
({
page
});
expect
(
RecentSearchesService
.
isAvailable
).
toHaveBeenCalled
();
expect
(
recentSearchesStoreSrc
.
default
).
toHaveBeenCalledWith
({
expect
(
RecentSearchesStoreSpy
).
toHaveBeenCalledWith
({
isLocalStorageAvailable
,
allowedKeys
:
FilteredSearchTokenKeys
.
getKeys
(),
});
...
...
@@ -164,7 +163,7 @@ describe('Filtered Search Manager', () => {
it
(
'
should search with a single word
'
,
(
done
)
=>
{
input
.
value
=
'
searchTerm
'
;
spyOn
(
urlUtils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
spyOn
Dependency
(
FilteredSearchManager
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&search=searchTerm`
);
done
();
});
...
...
@@ -175,7 +174,7 @@ describe('Filtered Search Manager', () => {
it
(
'
should search with multiple words
'
,
(
done
)
=>
{
input
.
value
=
'
awesome search terms
'
;
spyOn
(
urlUtils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
spyOn
Dependency
(
FilteredSearchManager
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&search=awesome+search+terms`
);
done
();
});
...
...
@@ -186,7 +185,7 @@ describe('Filtered Search Manager', () => {
it
(
'
should search with special characters
'
,
(
done
)
=>
{
input
.
value
=
'
~!@#$%^&*()_+{}:<>,.?/
'
;
spyOn
(
urlUtils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
spyOn
Dependency
(
FilteredSearchManager
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&search=~!%40%23%24%25%5E%26*()_%2B%7B%7D%3A%3C%3E%2C.%3F%2F`
);
done
();
});
...
...
@@ -200,7 +199,7 @@ describe('Filtered Search Manager', () => {
${
FilteredSearchSpecHelper
.
createFilterVisualTokenHTML
(
'
label
'
,
'
~bug
'
)}
`
);
spyOn
(
urlUtils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
spyOn
Dependency
(
FilteredSearchManager
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&label_name[]=bug`
);
done
();
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment