diff --git a/app/views/schemes/_scheme_list.html.erb b/app/views/schemes/_scheme_list.html.erb index a5b2ab06b..1de61b822 100644 --- a/app/views/schemes/_scheme_list.html.erb +++ b/app/views/schemes/_scheme_list.html.erb @@ -1,7 +1,7 @@
<%= govuk_table do |table| %> <%= 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 %> <%= table.head do |head| %> <%= head.row do |row| %> diff --git a/app/views/schemes/index.html.erb b/app/views/schemes/index.html.erb index 7d2ae2530..b424cfe95 100644 --- a/app/views/schemes/index.html.erb +++ b/app/views/schemes/index.html.erb @@ -11,6 +11,6 @@
-<%= 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" } %> diff --git a/spec/components/search_result_caption_component_spec.rb b/spec/components/search_result_caption_component_spec.rb index 3eb351b6d..eda71a255 100644 --- a/spec/components/search_result_caption_component_spec.rb +++ b/spec/components/search_result_caption_component_spec.rb @@ -15,6 +15,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do end 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 result = render_inline(described_class.new(searched:, count:, item_label:, total_count:, item:, path:)) expect(result.to_html).to eq(" \n #{count} #{item_label} found matching '#{searched}' of #{total_count} total #{item}. Clear search\n\n") diff --git a/spec/requests/schemes_controller_spec.rb b/spec/requests/schemes_controller_spec.rb index 38692811e..f06d03345 100644 --- a/spec/requests/schemes_controller_spec.rb +++ b/spec/requests/schemes_controller_spec.rb @@ -151,6 +151,7 @@ RSpec.describe SchemesController, type: :request do end it "updates the table caption" do + debugger expect(page).to have_content("1 scheme found matching ‘#{search_param}’") end