Browse Source

Tweak search result caption component

pull/795/head
Paul Robert Lloyd 3 years ago committed by baarkerlounger
parent
commit
5ca3129f07
  1. 2
      app/components/search_result_caption_component.html.erb
  2. 2
      spec/components/search_result_caption_component_spec.rb
  3. 2
      spec/requests/organisations_controller_spec.rb
  4. 6
      spec/requests/schemes_controller_spec.rb

2
app/components/search_result_caption_component.html.erb

@ -2,6 +2,6 @@
<% if searched.present? %> <% if searched.present? %>
<strong><%= count %></strong> <%= item_label %> found matching ‘<%= searched %>’ of <strong><%= total_count %></strong> total <%= item %>. <%= govuk_link_to("Clear search", path) %> <strong><%= count %></strong> <%= item_label %> found matching ‘<%= searched %>’ of <strong><%= total_count %></strong> total <%= item %>. <%= govuk_link_to("Clear search", path) %>
<% else %> <% else %>
<strong><%= count %></strong> total <%= item %>. <strong><%= count %></strong> total <%= item %>
<% end %> <% end %>
</span> </span>

2
spec/components/search_result_caption_component_spec.rb

@ -19,7 +19,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do
it "renders table caption with total count only" do it "renders table caption with total count only" do
result = render_inline(described_class.new(searched:, count:, item_label:, total_count:, item:, path:)) result = render_inline(described_class.new(searched:, count:, item_label:, total_count:, item:, path:))
expect(result.to_html).to eq(" <span class=\"govuk-!-margin-right-4\">\n <strong>#{count}</strong> total #{item}.\n</span>\n") expect(result.to_html).to eq("<span class=\"govuk-!-margin-right-4\">\n <strong>#{count}</strong> total #{item}\n</span>\n")
end end
end end
end end

2
spec/requests/organisations_controller_spec.rb

@ -892,7 +892,7 @@ RSpec.describe OrganisationsController, type: :request do
end end
it "shows the total organisations count" do it "shows the total organisations count" do
expect(CGI.unescape_html(response.body)).to match("<strong>#{total_organisations_count}</strong> total organisations.") expect(CGI.unescape_html(response.body)).to match("<strong>#{total_organisations_count}</strong> total organisations")
end end
it "has pagination links" do it "has pagination links" do

6
spec/requests/schemes_controller_spec.rb

@ -90,7 +90,7 @@ RSpec.describe SchemesController, type: :request do
end end
it "shows the total organisations count" do it "shows the total organisations count" do
expect(CGI.unescape_html(response.body)).to match("<strong>#{schemes.count}</strong> total schemes.") expect(CGI.unescape_html(response.body)).to match("<strong>#{schemes.count}</strong> total schemes")
end end
context "when params scheme_id is present" do context "when params scheme_id is present" do
@ -113,7 +113,7 @@ RSpec.describe SchemesController, type: :request do
end end
it "shows the total schemes count" do it "shows the total schemes count" do
expect(CGI.unescape_html(response.body)).to match("<strong>#{total_schemes_count}</strong> total schemes.") expect(CGI.unescape_html(response.body)).to match("<strong>#{total_schemes_count}</strong> total schemes")
end end
it "shows which schemes are being shown on the current page" do it "shows which schemes are being shown on the current page" do
@ -138,7 +138,7 @@ RSpec.describe SchemesController, type: :request do
end end
it "shows the total schemes count" do it "shows the total schemes count" do
expect(CGI.unescape_html(response.body)).to match("<strong>#{total_schemes_count}</strong> total schemes.") expect(CGI.unescape_html(response.body)).to match("<strong>#{total_schemes_count}</strong> total schemes")
end end
it "has pagination links" do it "has pagination links" do

Loading…
Cancel
Save