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
6ff7a738
Commit
6ff7a738
authored
Sep 06, 2017
by
Bryce Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't modify the prototype in specs.
parent
69be5f5c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
17 deletions
+6
-17
spec/javascripts/filtered_search/filtered_search_manager_spec.js
...vascripts/filtered_search/filtered_search_manager_spec.js
+6
-17
No files found.
spec/javascripts/filtered_search/filtered_search_manager_spec.js
View file @
6ff7a738
...
...
@@ -441,32 +441,21 @@ describe('Filtered Search Manager', () => {
beforeEach
(()
=>
{
this
.
paramsArr
=
[
'
key=value
'
,
'
otherkey=othervalue
'
];
Object
.
assign
(
gl
.
FilteredSearchManager
.
prototype
,
{
modifyUrlParams
:
paramsArr
=>
paramsArr
.
reverse
(),
});
spyOn
(
gl
.
FilteredSearchManager
.
prototype
,
'
modifyUrlParams
'
).
and
.
callThrough
();
initializeManager
();
});
it
(
'
calls modifyUrlParams when present
'
,
()
=>
{
manager
.
getAllParams
(
this
.
paramsArr
);
expect
(
manager
.
modifyUrlParams
).
toHaveBeenCalled
();
});
it
(
'
correctly modifies params when custom modifier is passed
'
,
()
=>
{
const
modifedParams
=
manager
.
getAllParams
(
this
.
paramsArr
);
const
modifedParams
=
manager
.
getAllParams
.
call
({
modifyUrlParams
:
paramsArr
=>
paramsArr
.
reverse
(),
},
[].
concat
(
this
.
paramsArr
));
expect
(
modifedParams
[
0
]).
toBe
(
'
otherkey=othervalue
'
);
expect
(
modifedParams
[
0
]).
toBe
(
this
.
paramsArr
[
1
]
);
});
it
(
'
does not modify params when no custom modifier is passed
'
,
()
=>
{
Object
.
assign
(
gl
.
FilteredSearchManager
.
prototype
,
{
modifyUrlParams
:
undefined
});
const
modifedParams
=
manager
.
getAllParams
(
this
.
paramsArr
);
const
modifedParams
=
manager
.
getAllParams
.
call
({},
this
.
paramsArr
);
expect
(
modifedParams
[
1
]).
toBe
(
'
otherkey=othervalue
'
);
expect
(
modifedParams
[
1
]).
toBe
(
this
.
paramsArr
[
1
]
);
});
});
});
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