Skip to content

Commit a4f1468

Browse files
committed
Merge pull request #639 from projectblacklight/search-header-partial
render search results header content (did you mean, constraints, sort an...
2 parents d7d32c2 + 195cfd0 commit a4f1468

File tree

4 files changed

+36
-5
lines changed

4 files changed

+36
-5
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<%= render 'did_you_mean' %>
2+
3+
<%= render 'constraints' %>
4+
5+
<%= render 'sort_and_per_page' %>

app/views/catalog/index.html.erb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@
1616

1717
<% extra_head_content << render_opensearch_response_metadata.html_safe %>
1818

19-
<%= render 'did_you_mean' %>
20-
21-
<%= render 'constraints' %>
22-
23-
<%= render 'sort_and_per_page' %>
19+
<%= render 'search_header' %>
2420

2521
<h2 class="hide-text"><%= t('blacklight.search.search_results') %></h2>
2622

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# -*- encoding : utf-8 -*-
2+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
3+
4+
# spec for sidebar partial in catalog show view
5+
6+
describe "/catalog/_search_header.html.erb" do
7+
8+
it "should render the default search header partials" do
9+
stub_template "_did_you_mean.html.erb" => "did_you_mean"
10+
stub_template "_constraints.html.erb" => "constraints"
11+
stub_template "_sort_and_per_page.html.erb" => "sort_and_per_page"
12+
render
13+
expect(rendered).to match /did_you_mean/
14+
expect(rendered).to match /constraints/
15+
expect(rendered).to match /sort_and_per_page/
16+
end
17+
end

spec/views/catalog/index.html.erb_spec.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,17 @@
1515
render
1616
expect(rendered).to match /sidebar_content/
1717
end
18+
19+
it "should render the search_header partial " do
20+
stub_template "catalog/_results_pagination.html.erb" => ""
21+
stub_template "catalog/_search_header.html.erb" => "header_content"
22+
23+
view.stub(:blacklight_config).and_return(Blacklight::Configuration.new)
24+
view.stub(:has_search_parameters?).and_return(true)
25+
view.stub(:extra_head_content).and_return([])
26+
view.stub(:render_opensearch_response_metadata).and_return("")
27+
view.stub(:response_has_no_search_results?).and_return(true)
28+
render
29+
expect(rendered).to match /header_content/
30+
end
1831
end

0 commit comments

Comments
 (0)