diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /spec/features/search/user_uses_search_filters_spec.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) | |
download | gitlab-ce-48aff82709769b098321c738f3444b9bdaa694c6.tar.gz |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'spec/features/search/user_uses_search_filters_spec.rb')
-rw-r--r-- | spec/features/search/user_uses_search_filters_spec.rb | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/spec/features/search/user_uses_search_filters_spec.rb b/spec/features/search/user_uses_search_filters_spec.rb index f39a1f8fe37..080cced21c3 100644 --- a/spec/features/search/user_uses_search_filters_spec.rb +++ b/spec/features/search/user_uses_search_filters_spec.rb @@ -12,12 +12,12 @@ RSpec.describe 'User uses search filters', :js do project.add_reporter(user) group.add_owner(user) sign_in(user) - - visit(search_path) end context 'when filtering by group' do it 'shows group projects' do + visit search_path + find('.js-search-group-dropdown').click wait_for_requests @@ -36,10 +36,27 @@ RSpec.describe 'User uses search filters', :js do expect(page).to have_link(group_project.full_name) end end + + context 'when the group filter is set' do + before do + visit search_path(search: "test", group_id: group.id, project_id: project.id) + end + + describe 'clear filter button' do + it 'removes Group and Project filters' do + link = find('[data-testid="group-filter"] .js-search-clear') + params = CGI.parse(URI.parse(link[:href]).query) + + expect(params).not_to include(:group_id, :project_id) + end + end + end end context 'when filtering by project' do it 'shows a project' do + visit search_path + page.within('.project-filter') do find('.js-search-project-dropdown').click @@ -50,5 +67,22 @@ RSpec.describe 'User uses search filters', :js do expect(find('.js-search-project-dropdown')).to have_content(project.full_name) end + + context 'when the project filter is set' do + before do + visit search_path(search: "test", project_id: project.id) + end + + let(:query) { { project_id: project.id } } + + describe 'clear filter button' do + it 'removes Project filters' do + link = find('.project-filter .js-search-clear') + params = CGI.parse(URI.parse(link[:href]).query) + + expect(params).not_to include(:project_id) + end + end + end end end |