diff options
author | Bryce Johnson <bryce@gitlab.com> | 2017-09-06 21:44:59 +0300 |
---|---|---|
committer | Bryce Johnson <bryce@gitlab.com> | 2017-09-07 18:49:36 +0300 |
commit | 1bd4cd4441dc747c468e6651ff544dd24eb235da (patch) | |
tree | bc1e61b15df6bd4cbb35e5cb923088806b0e4fb7 /spec/javascripts/filtered_search | |
parent | 5f6545f36cde706d1fbe7efc429b9c0d8273f96a (diff) |
Backport getAllParams and other nav changes from service desk.
Diffstat (limited to 'spec/javascripts/filtered_search')
-rw-r--r-- | spec/javascripts/filtered_search/filtered_search_manager_spec.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/javascripts/filtered_search/filtered_search_manager_spec.js b/spec/javascripts/filtered_search/filtered_search_manager_spec.js index 16ae649ee60..f209328dee1 100644 --- a/spec/javascripts/filtered_search/filtered_search_manager_spec.js +++ b/spec/javascripts/filtered_search/filtered_search_manager_spec.js @@ -411,4 +411,26 @@ describe('Filtered Search Manager', () => { expect(document.querySelector('.filtered-search-box').classList.contains('focus')).toEqual(false); }); }); + + describe('getAllParams', () => { + beforeEach(() => { + this.paramsArr = ['key=value', 'otherkey=othervalue']; + + initializeManager(); + }); + + it('correctly modifies params when custom modifier is passed', () => { + const modifedParams = manager.getAllParams.call({ + modifyUrlParams: paramsArr => paramsArr.reverse(), + }, [].concat(this.paramsArr)); + + expect(modifedParams[0]).toBe(this.paramsArr[1]); + }); + + it('does not modify params when no custom modifier is passed', () => { + const modifedParams = manager.getAllParams.call({}, this.paramsArr); + + expect(modifedParams[1]).toBe(this.paramsArr[1]); + }); + }); }); |