diff options
author | Filipa Lacerda <lacerda.filipa@gmail.com> | 2017-02-01 23:53:58 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-02-02 12:07:38 +0300 |
commit | 7b02d450353526901266f5fe7f9bd5deddb6a5a3 (patch) | |
tree | 8614f2e09feb8788f5de685a86c9f5636bb7e40a /spec | |
parent | c759724fba5d1f7090056b82a15b03979ef17546 (diff) |
Merge branch 'fix-filtering-username-with-multiple-words' into 'master'
Fix filtering usernames with multiple words
Closes #27404
See merge request !8851
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/filtered_search/dropdown_user_spec.js.es6 | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/javascripts/filtered_search/dropdown_user_spec.js.es6 b/spec/javascripts/filtered_search/dropdown_user_spec.js.es6 new file mode 100644 index 00000000000..5eba4343a1d --- /dev/null +++ b/spec/javascripts/filtered_search/dropdown_user_spec.js.es6 @@ -0,0 +1,40 @@ +//= require filtered_search/dropdown_utils +//= require filtered_search/filtered_search_tokenizer +//= require filtered_search/filtered_search_dropdown +//= require filtered_search/dropdown_user + +(() => { + describe('Dropdown User', () => { + describe('getSearchInput', () => { + let dropdownUser; + + beforeEach(() => { + spyOn(gl.FilteredSearchDropdown.prototype, 'constructor').and.callFake(() => {}); + spyOn(gl.DropdownUser.prototype, 'getProjectId').and.callFake(() => {}); + spyOn(gl.DropdownUtils, 'getSearchInput').and.callFake(() => {}); + + dropdownUser = new gl.DropdownUser(); + }); + + it('should not return the double quote found in value', () => { + spyOn(gl.FilteredSearchTokenizer, 'processTokens').and.returnValue({ + lastToken: { + value: '"johnny appleseed', + }, + }); + + expect(dropdownUser.getSearchInput()).toBe('johnny appleseed'); + }); + + it('should not return the single quote found in value', () => { + spyOn(gl.FilteredSearchTokenizer, 'processTokens').and.returnValue({ + lastToken: { + value: '\'larry boy', + }, + }); + + expect(dropdownUser.getSearchInput()).toBe('larry boy'); + }); + }); + }); +})(); |