diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2017-02-21 05:08:03 +0300 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2017-02-21 05:08:03 +0300 |
commit | b596dd8fedd9dc8f9487e1e67a52a7b211bd956b (patch) | |
tree | ed3eab395f767bb1232b286c104ef1ad81243c83 /spec | |
parent | 510c51a6b5fd822755046e10f5c5d875ad5fba9f (diff) | |
parent | fe1ab40529bd91eea6e2f9e086bbf9b91ae37891 (diff) |
Merge branch '28357-colon-search' into 'master'
Allow searching issues for strings containing colons
Closes #28357
See merge request !9400
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/filtered_search/filtered_search_tokenizer_spec.js.es6 | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/javascripts/filtered_search/filtered_search_tokenizer_spec.js.es6 b/spec/javascripts/filtered_search/filtered_search_tokenizer_spec.js.es6 index 84c0e9cbfe2..a91801cfc89 100644 --- a/spec/javascripts/filtered_search/filtered_search_tokenizer_spec.js.es6 +++ b/spec/javascripts/filtered_search/filtered_search_tokenizer_spec.js.es6 @@ -99,6 +99,29 @@ require('~/filtered_search/filtered_search_tokenizer'); expect(results.tokens[2].value).toBe('Doing'); expect(results.tokens[2].symbol).toBe('~'); }); + + it('returns search value for invalid tokens', () => { + const results = gl.FilteredSearchTokenizer.processTokens('fake:token'); + expect(results.lastToken).toBe('fake:token'); + expect(results.searchToken).toBe('fake:token'); + expect(results.tokens.length).toEqual(0); + }); + + it('returns search value and token for mix of valid and invalid tokens', () => { + const results = gl.FilteredSearchTokenizer.processTokens('label:real fake:token'); + expect(results.tokens.length).toEqual(1); + expect(results.tokens[0].key).toBe('label'); + expect(results.tokens[0].value).toBe('real'); + expect(results.tokens[0].symbol).toBe(''); + expect(results.lastToken).toBe('fake:token'); + expect(results.searchToken).toBe('fake:token'); + }); + + it('returns search value for invalid symbols', () => { + const results = gl.FilteredSearchTokenizer.processTokens('std::includes'); + expect(results.lastToken).toBe('std::includes'); + expect(results.searchToken).toBe('std::includes'); + }); }); }); })(); |