diff options
author | Phil Hughes <me@iamphill.com> | 2019-02-15 11:34:24 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-02-15 11:34:24 +0300 |
commit | 4b50e4d5edf6f89a4833b402d97edf45cdc9eac1 (patch) | |
tree | 0ed947bbdcf7a052cdda8d240bc7fe28d7f3ceff | |
parent | d9328cb3e3c4e71b02e2a1ceb304997ddebd6fdd (diff) | |
parent | 65f534da1c4f6142a4e075aef41744a3c2b5eae9 (diff) |
Merge branch '57692-fix-rendering-of-none-any' into 'master'
Resolve "Search bar rendering `none` and `any` as users"
Closes #57692
See merge request gitlab-org/gitlab-ce!25235
-rw-r--r-- | app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js | 2 | ||||
-rw-r--r-- | spec/javascripts/filtered_search/filtered_search_visual_tokens_spec.js | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js b/app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js index fba31f16d65..5090b0bdc3c 100644 --- a/app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js +++ b/app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js @@ -163,7 +163,7 @@ export default class FilteredSearchVisualTokens { const tokenValueElement = tokenValueContainer.querySelector('.value'); tokenValueElement.innerText = tokenValue; - if (tokenValue === 'none' || tokenValue === 'any') { + if (['none', 'any'].includes(tokenValue.toLowerCase())) { return; } diff --git a/spec/javascripts/filtered_search/filtered_search_visual_tokens_spec.js b/spec/javascripts/filtered_search/filtered_search_visual_tokens_spec.js index 9aa3cbaa231..6230da77f49 100644 --- a/spec/javascripts/filtered_search/filtered_search_visual_tokens_spec.js +++ b/spec/javascripts/filtered_search/filtered_search_visual_tokens_spec.js @@ -755,6 +755,17 @@ describe('Filtered Search Visual Tokens', () => { expect(updateUserTokenAppearanceSpy.calls.count()).toBe(0); }); + it('does not update user token appearance for `None` filter', () => { + const { tokenNameElement } = findElements(authorToken); + + const tokenName = tokenNameElement.innerText; + const tokenValue = 'None'; + + subject.renderVisualTokenValue(authorToken, tokenName, tokenValue); + + expect(updateUserTokenAppearanceSpy.calls.count()).toBe(0); + }); + it('does not update user token appearance for `none` filter', () => { const { tokenNameElement } = findElements(authorToken); |