Browse Source

push for review

pull/673/head
Ted 3 years ago committed by JG
parent
commit
bee82d3a33
  1. 2
      app/views/schemes/_scheme_list.html.erb
  2. 2
      app/views/schemes/index.html.erb
  3. 1
      spec/components/search_result_caption_component_spec.rb
  4. 1
      spec/requests/schemes_controller_spec.rb

2
app/views/schemes/_scheme_list.html.erb

@ -1,7 +1,7 @@
<section class="app-table-group" tabindex="0" aria-labelledby="<%= title.dasherize %>"> <section class="app-table-group" tabindex="0" aria-labelledby="<%= title.dasherize %>">
<%= govuk_table do |table| %> <%= govuk_table do |table| %>
<%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %> <%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %>
<%= render(SearchResultCaptionComponent.new(searched:, count: pagy.count, item_label:, total_count:, item: "schemes", path: request.path)) %> <%= render(SearchResultCaptionComponent.new(searched: searched, count: pagy.count, item_label: item_label , total_count: total_count, item: "schemes", path: request.path)) %>
<% end %> <% end %>
<%= table.head do |head| %> <%= table.head do |head| %>
<%= head.row do |row| %> <%= head.row do |row| %>

2
app/views/schemes/index.html.erb

@ -11,6 +11,6 @@
<hr class="govuk-section-break govuk-section-break--visible govuk-section-break--m"> <hr class="govuk-section-break govuk-section-break--visible govuk-section-break--m">
<%= render partial: "schemes/scheme_list", locals: { schemes: @schemes, title:, pagy: @pagy, searched: @searched, item_label:, total_count: @total_count } %> <%= render partial: "schemes/scheme_list", locals: { schemes: @schemes, title:, pagy: @pagy, searched: @searched, item_label: item_label, total_count: @total_count } %>
<%== render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "schemes" } %> <%== render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "schemes" } %>

1
spec/components/search_result_caption_component_spec.rb

@ -15,6 +15,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do
end end
context "when no search results are found" do context "when no search results are found" do
let(:searched) { nil }
it "all of the nav tabs specified in the items hash are passed to it" do it "all of the nav tabs specified in the items hash are passed to it" 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> #{item_label} found matching '#{searched}' of <strong>#{total_count}</strong> total #{item}. <a class=\"govuk-link\" href=\"path\">Clear search</a>\n</span>\n") expect(result.to_html).to eq(" <span class=\"govuk-!-margin-right-4\">\n <strong>#{count}</strong> #{item_label} found matching '#{searched}' of <strong>#{total_count}</strong> total #{item}. <a class=\"govuk-link\" href=\"path\">Clear search</a>\n</span>\n")

1
spec/requests/schemes_controller_spec.rb

@ -151,6 +151,7 @@ RSpec.describe SchemesController, type: :request do
end end
it "updates the table caption" do it "updates the table caption" do
debugger
expect(page).to have_content("1 scheme found matching ‘#{search_param}") expect(page).to have_content("1 scheme found matching ‘#{search_param}")
end end

Loading…
Cancel
Save