diff options
author | Denys Mishunov <dmishunov@gitlab.com> | 2019-07-24 15:30:47 +0200 |
---|---|---|
committer | Denys Mishunov <dmishunov@gitlab.com> | 2019-08-07 11:57:38 +0200 |
commit | 4bb8a4e3d3cd74e6e7a40c5e7805dd3670fdfc37 (patch) | |
tree | 5ad7d49baeefe9535965942270923c8c04633263 | |
parent | 9e421d6d4e7eb6564f7a21db8921f6f8163b0b90 (diff) | |
download | gitlab-ce-4bb8a4e3d3cd74e6e7a40c5e7805dd3670fdfc37.tar.gz |
Replaced breadcrumbs with title on Search page
-rw-r--r-- | app/views/search/show.html.haml | 6 | ||||
-rw-r--r-- | spec/features/search/user_uses_header_search_field_spec.rb | 2 | ||||
-rw-r--r-- | spec/views/search/show.html.haml_spec.rb | 37 |
3 files changed, 43 insertions, 2 deletions
diff --git a/app/views/search/show.html.haml b/app/views/search/show.html.haml index 3260d05f509..9235678bc1d 100644 --- a/app/views/search/show.html.haml +++ b/app/views/search/show.html.haml @@ -1,6 +1,10 @@ - @hide_top_links = true -- breadcrumb_title _("Search") - page_title @search_term +- @hide_breadcrumbs = true + +.page-title-holder.d-flex.align-items-center + %h1.page-title< + = _('Search') .prepend-top-default = render 'search/form' 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/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 |