diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-29 00:06:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-29 00:06:24 +0300 |
commit | ef326e805ac99222c55e1efd9867045800f01a4b (patch) | |
tree | 201d39fb90a1422cc1f523d95b30b93e95f973f5 /spec/features/issues/filtered_search | |
parent | 7515ec41c527c62bfd56f46e388cf6d9fe06479f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/issues/filtered_search')
-rw-r--r-- | spec/features/issues/filtered_search/dropdown_hint_spec.rb | 11 | ||||
-rw-r--r-- | spec/features/issues/filtered_search/dropdown_release_spec.rb | 55 |
2 files changed, 65 insertions, 1 deletions
diff --git a/spec/features/issues/filtered_search/dropdown_hint_spec.rb b/spec/features/issues/filtered_search/dropdown_hint_spec.rb index 1c56902a27d..bb57d69148b 100644 --- a/spec/features/issues/filtered_search/dropdown_hint_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_hint_spec.rb @@ -68,7 +68,7 @@ describe 'Dropdown hint', :js do it 'filters with text' do filtered_search.set('a') - expect(find(js_dropdown_hint)).to have_selector('.filter-dropdown .filter-dropdown-item', count: 5) + expect(find(js_dropdown_hint)).to have_selector('.filter-dropdown .filter-dropdown-item', count: 6) end end @@ -104,6 +104,15 @@ describe 'Dropdown hint', :js do expect_filtered_search_input_empty end + it 'opens the release dropdown when you click on release' do + click_hint('release') + + expect(page).to have_css(js_dropdown_hint, visible: false) + expect(page).to have_css('#js-dropdown-release', visible: true) + expect_tokens([{ name: 'Release' }]) + expect_filtered_search_input_empty + end + it 'opens the label dropdown when you click on label' do click_hint('label') diff --git a/spec/features/issues/filtered_search/dropdown_release_spec.rb b/spec/features/issues/filtered_search/dropdown_release_spec.rb new file mode 100644 index 00000000000..eea7f2d7848 --- /dev/null +++ b/spec/features/issues/filtered_search/dropdown_release_spec.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'Dropdown release', :js do + include FilteredSearchHelpers + + let!(:project) { create(:project, :repository) } + let!(:user) { create(:user) } + let!(:release) { create(:release, tag: 'v1.0', project: project) } + let!(:crazy_release) { create(:release, tag: '☺!/"#%&\'{}+,-.<>;=@]_`{|}🚀', project: project) } + + def filtered_search + find('.filtered-search') + end + + def filter_dropdown + find('#js-dropdown-release .filter-dropdown') + end + + before do + project.add_maintainer(user) + sign_in(user) + create(:issue, project: project) + + visit project_issues_path(project) + end + + describe 'behavior' do + before do + filtered_search.set('release:') + end + + def expect_results(count) + expect(filter_dropdown).to have_selector('.filter-dropdown .filter-dropdown-item', count: count) + end + + it 'loads all the releases when opened' do + expect_results(2) + end + + it 'filters by tag name' do + filtered_search.send_keys("☺") + expect_results(1) + end + + it 'fills in the release name when the autocomplete hint is clicked' do + find('#js-dropdown-release .filter-dropdown-item', text: crazy_release.tag).click + + expect(page).to have_css('#js-dropdown-release', visible: false) + expect_tokens([release_token(crazy_release.tag)]) + expect_filtered_search_input_empty + end + end +end |