diff options
author | Paul Slaughter <pslaughter@gitlab.com> | 2019-08-07 14:58:53 +0000 |
---|---|---|
committer | Paul Slaughter <pslaughter@gitlab.com> | 2019-08-07 14:58:53 +0000 |
commit | 35e49d3be0ffe58fef80c30f6b432312541b8a73 (patch) | |
tree | 5e5b3617ee8e14c15286bbce8c1f1a2330c9a489 /spec | |
parent | 2b7218cfe56dcbcb287bea7f7d4bd094a2822f00 (diff) | |
parent | f89a8fee9d98b9d28d09123496c971fcc5949fff (diff) | |
download | gitlab-ce-35e49d3be0ffe58fef80c30f6b432312541b8a73.tar.gz |
Merge branch '47814-search-view-labels' into 'master'
Resolve "Selected project in the search view is not fully readable"
Closes #47814
See merge request gitlab-org/gitlab-ce!31137
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/search/user_uses_header_search_field_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/search/user_uses_search_filters_spec.rb | 2 | ||||
-rw-r--r-- | spec/views/search/_filter.html.haml_spec.rb | 17 | ||||
-rw-r--r-- | spec/views/search/_form.html.haml_spec.rb | 14 | ||||
-rw-r--r-- | spec/views/search/show.html.haml_spec.rb | 37 |
5 files changed, 70 insertions, 2 deletions
diff --git a/spec/features/search/user_uses_header_search_field_spec.rb b/spec/features/search/user_uses_header_search_field_spec.rb index 29ce5425323..c781048d06d 100644 --- a/spec/features/search/user_uses_header_search_field_spec.rb +++ b/spec/features/search/user_uses_header_search_field_spec.rb @@ -22,7 +22,7 @@ describe 'User uses header search field', :js do fill_in('search', with: 'gitlab') find('#search').native.send_keys(:enter) - page.within('.breadcrumbs-sub-title') do + page.within('.page-title') do expect(page).to have_content('Search') end end diff --git a/spec/features/search/user_uses_search_filters_spec.rb b/spec/features/search/user_uses_search_filters_spec.rb index f5cda15b38a..fbd7da3c643 100644 --- a/spec/features/search/user_uses_search_filters_spec.rb +++ b/spec/features/search/user_uses_search_filters_spec.rb @@ -22,7 +22,7 @@ describe 'User uses search filters', :js do wait_for_requests - page.within('.search-holder') do + page.within('.search-page-form') do click_link(group.name) end diff --git a/spec/views/search/_filter.html.haml_spec.rb b/spec/views/search/_filter.html.haml_spec.rb new file mode 100644 index 00000000000..d2cd636f8c6 --- /dev/null +++ b/spec/views/search/_filter.html.haml_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'search/_filter' do + context 'when the search page is opened' do + it 'displays the correct elements' do + render + + expect(rendered).to have_selector('label[for="dashboard_search_group"]') + expect(rendered).to have_selector('button#dashboard_search_group') + + expect(rendered).to have_selector('label[for="dashboard_search_project"]') + expect(rendered).to have_selector('button#dashboard_search_project') + end + end +end diff --git a/spec/views/search/_form.html.haml_spec.rb b/spec/views/search/_form.html.haml_spec.rb new file mode 100644 index 00000000000..69f40895d86 --- /dev/null +++ b/spec/views/search/_form.html.haml_spec.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'search/_form' do + context 'when the search page is opened' do + it 'displays the correct elements' do + render + + expect(rendered).to have_selector('.search-field-holder.form-group') + expect(rendered).to have_selector('label[for="dashboard_search"]') + end + end +end diff --git a/spec/views/search/show.html.haml_spec.rb b/spec/views/search/show.html.haml_spec.rb new file mode 100644 index 00000000000..483b913f2cc --- /dev/null +++ b/spec/views/search/show.html.haml_spec.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'search/show' do + let(:search_term) { nil } + + before do + stub_template "search/_category.html.haml" => 'Category Partial' + stub_template "search/_results.html.haml" => 'Results Partial' + + @search_term = search_term + + render + end + + context 'when the search page is opened' do + it 'displays the title' do + expect(rendered).to have_selector('h1.page-title', text: 'Search') + expect(rendered).not_to have_selector('h1.page-title code') + end + + it 'does not render partials' do + expect(rendered).not_to render_template('search/_category') + expect(rendered).not_to render_template('search/_results') + end + end + + context 'when search term is supplied' do + let(:search_term) { 'Search Foo' } + + it 'renders partials' do + expect(rendered).to render_template('search/_category') + expect(rendered).to render_template('search/_results') + end + end +end |