diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2017-11-09 19:20:12 +0300 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2017-11-09 19:20:12 +0300 |
commit | f033a70c54fac7a293e1c884f1299e9e08d7a5d4 (patch) | |
tree | 3c665d76e8ffd9eae9da9b4e7f9635fe61266dac /spec | |
parent | 5d5d7f914c06a18dea567c8d90d0028fb3f86d07 (diff) | |
parent | 6cbf6c5203302c651e606294d746fb33d6bf38c3 (diff) |
Merge branch 'move-filter-mr-clear-search-spec-to-js' into 'master'
Move clear search test to JS to reduce overkill
See merge request gitlab-org/gitlab-ce!15154
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/merge_requests/filter_by_labels_spec.rb | 16 | ||||
-rw-r--r-- | spec/javascripts/filtered_search/filtered_search_manager_spec.js | 19 |
2 files changed, 19 insertions, 16 deletions
diff --git a/spec/features/merge_requests/filter_by_labels_spec.rb b/spec/features/merge_requests/filter_by_labels_spec.rb index 9912e8165e6..7adae08e499 100644 --- a/spec/features/merge_requests/filter_by_labels_spec.rb +++ b/spec/features/merge_requests/filter_by_labels_spec.rb @@ -79,22 +79,6 @@ feature 'Merge Request filtering by Labels', :js do end end - context 'clear button' do - before do - input_filtered_search('label:~bug') - end - - it 'allows user to remove filtered labels' do - first('.clear-search').click - filtered_search.send_keys(:enter) - - expect(page).to have_issuable_counts(open: 3, closed: 0, all: 3) - expect(page).to have_content "Bugfix2" - expect(page).to have_content "Feature1" - expect(page).to have_content "Bugfix1" - end - end - context 'filter dropdown' do it 'filters by label name' do init_label_search diff --git a/spec/javascripts/filtered_search/filtered_search_manager_spec.js b/spec/javascripts/filtered_search/filtered_search_manager_spec.js index f209328dee1..230c15e5de6 100644 --- a/spec/javascripts/filtered_search/filtered_search_manager_spec.js +++ b/spec/javascripts/filtered_search/filtered_search_manager_spec.js @@ -396,6 +396,25 @@ describe('Filtered Search Manager', () => { }); }); + describe('Clearing search', () => { + beforeEach(() => { + initializeManager(); + }); + + it('Clicking the "x" clear button, clears the input', () => { + const inputValue = 'label:~bug '; + manager.filteredSearchInput.value = inputValue; + manager.filteredSearchInput.dispatchEvent(new Event('input')); + + expect(gl.DropdownUtils.getSearchQuery()).toEqual(inputValue); + + manager.clearSearchButton.click(); + + expect(manager.filteredSearchInput.value).toEqual(''); + expect(gl.DropdownUtils.getSearchQuery()).toEqual(''); + }); + }); + describe('toggleInputContainerFocus', () => { beforeEach(() => { initializeManager(); |