From 21c232f21bfec57a7da72afa63dc88f910fc83bd Mon Sep 17 00:00:00 2001 From: Jack Reed Date: Mon, 24 Aug 2015 17:23:31 -0700 Subject: [PATCH] add sitelinks search --- app/views/catalog/index.html.erb | 1 + app/views/shared/_sitelinks_search_box.html.erb | 12 ++++++++++++ spec/features/sitelinks_search_box.rb | 12 ++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 app/views/shared/_sitelinks_search_box.html.erb create mode 100644 spec/features/sitelinks_search_box.rb diff --git a/app/views/catalog/index.html.erb b/app/views/catalog/index.html.erb index 9cee7bcdb0..a3cd9c12f3 100644 --- a/app/views/catalog/index.html.erb +++ b/app/views/catalog/index.html.erb @@ -6,6 +6,7 @@ <% unless has_search_parameters? %> <%# if there are no input/search related params, display the "home" partial -%> <%= render 'home' %> + <%= render 'shared/sitelinks_search_box' %> <% else %> <%= render 'search_results' %> <% end %> diff --git a/app/views/shared/_sitelinks_search_box.html.erb b/app/views/shared/_sitelinks_search_box.html.erb new file mode 100644 index 0000000000..ad9e144267 --- /dev/null +++ b/app/views/shared/_sitelinks_search_box.html.erb @@ -0,0 +1,12 @@ + diff --git a/spec/features/sitelinks_search_box.rb b/spec/features/sitelinks_search_box.rb new file mode 100644 index 0000000000..1b5081ed4a --- /dev/null +++ b/spec/features/sitelinks_search_box.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +feature 'Sitelinks search box' do + scenario 'is home page' do + visit root_path + expect(page).to have_css 'script[type="application/ld+json"]' + end + scenario 'on search page' do + visit catalog_index_path q: 'book' + expect(page).to_not have_css 'script[type="application/ld+json"]' + end +end