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
Hide 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
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
'
;
...
@@ -74,18 +72,19 @@ describe('Filtered Search Manager', () => {
...
@@ -74,18 +72,19 @@ describe('Filtered Search Manager', () => {
describe
(
'
class constructor
'
,
()
=>
{
describe
(
'
class constructor
'
,
()
=>
{
const
isLocalStorageAvailable
=
'
isLocalStorageAvailable
'
;
const
isLocalStorageAvailable
=
'
isLocalStorageAvailable
'
;
let
RecentSearchesStoreSpy
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
spyOn
(
RecentSearchesService
,
'
isAvailable
'
).
and
.
returnValue
(
isLocalStorageAvailable
);
spyOn
(
RecentSearchesService
,
'
isAvailable
'
).
and
.
returnValue
(
isLocalStorageAvailable
);
spyOn
(
recentSearchesStoreSrc
,
'
default
'
);
spyOn
(
RecentSearchesRoot
.
prototype
,
'
render
'
);
spyOn
(
RecentSearchesRoot
.
prototype
,
'
render
'
);
RecentSearchesStoreSpy
=
spyOnDependency
(
FilteredSearchManager
,
'
RecentSearchesStore
'
);
});
});
it
(
'
should instantiate RecentSearchesStore with isLocalStorageAvailable
'
,
()
=>
{
it
(
'
should instantiate RecentSearchesStore with isLocalStorageAvailable
'
,
()
=>
{
manager
=
new
FilteredSearchManager
({
page
});
manager
=
new
FilteredSearchManager
({
page
});
expect
(
RecentSearchesService
.
isAvailable
).
toHaveBeenCalled
();
expect
(
RecentSearchesService
.
isAvailable
).
toHaveBeenCalled
();
expect
(
recentSearchesStoreSrc
.
default
).
toHaveBeenCalledWith
({
expect
(
RecentSearchesStoreSpy
).
toHaveBeenCalledWith
({
isLocalStorageAvailable
,
isLocalStorageAvailable
,
allowedKeys
:
FilteredSearchTokenKeys
.
getKeys
(),
allowedKeys
:
FilteredSearchTokenKeys
.
getKeys
(),
});
});
...
@@ -164,7 +163,7 @@ describe('Filtered Search Manager', () => {
...
@@ -164,7 +163,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
(
urlUtils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
spyOn
Dependency
(
FilteredSearchManager
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&search=searchTerm`
);
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&search=searchTerm`
);
done
();
done
();
});
});
...
@@ -175,7 +174,7 @@ describe('Filtered Search Manager', () => {
...
@@ -175,7 +174,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
(
urlUtils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
spyOn
Dependency
(
FilteredSearchManager
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&search=awesome+search+terms`
);
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&search=awesome+search+terms`
);
done
();
done
();
});
});
...
@@ -186,7 +185,7 @@ describe('Filtered Search Manager', () => {
...
@@ -186,7 +185,7 @@ describe('Filtered Search Manager', () => {
it
(
'
should search with special characters
'
,
(
done
)
=>
{
it
(
'
should search with special characters
'
,
(
done
)
=>
{
input
.
value
=
'
~!@#$%^&*()_+{}:<>,.?/
'
;
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`
);
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&search=~!%40%23%24%25%5E%26*()_%2B%7B%7D%3A%3C%3E%2C.%3F%2F`
);
done
();
done
();
});
});
...
@@ -200,7 +199,7 @@ describe('Filtered Search Manager', () => {
...
@@ -200,7 +199,7 @@ describe('Filtered Search Manager', () => {
${
FilteredSearchSpecHelper
.
createFilterVisualTokenHTML
(
'
label
'
,
'
~bug
'
)}
${
FilteredSearchSpecHelper
.
createFilterVisualTokenHTML
(
'
label
'
,
'
~bug
'
)}
`
);
`
);
spyOn
(
urlUtils
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
spyOn
Dependency
(
FilteredSearchManager
,
'
visitUrl
'
).
and
.
callFake
((
url
)
=>
{
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&label_name[]=bug`
);
expect
(
url
).
toEqual
(
`
${
defaultParams
}
&label_name[]=bug`
);
done
();
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