diff --git a/app/components/search_result_caption_component.html.erb b/app/components/search_result_caption_component.html.erb index 8f3d7e5c3..9bb2fcaac 100644 --- a/app/components/search_result_caption_component.html.erb +++ b/app/components/search_result_caption_component.html.erb @@ -1,11 +1,13 @@ - + <% if searched.present? && filters_count&.positive? %> - <%= count %> <%= item_label.pluralize(count) %> matching search and filters + <%= count %> <%= item_label.pluralize(count) %> matching search and filters
<% elsif searched.present? %> - <%= count %> <%= item_label.pluralize(count) %> matching search + <%= count %> <%= item_label.pluralize(count) %> matching search
<% elsif filters_count&.positive? %> - <%= count %> <%= item_label.pluralize(count) %> matching filters + <%= count %> <%= item_label.pluralize(count) %> matching filters
<% else %> - <%= count %> matching <%= item %> + + <%= count %> matching <%= item %> + <% end %>
diff --git a/spec/components/search_result_caption_component_spec.rb b/spec/components/search_result_caption_component_spec.rb index fa136d91b..a6f7c3c3b 100644 --- a/spec/components/search_result_caption_component_spec.rb +++ b/spec/components/search_result_caption_component_spec.rb @@ -11,7 +11,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do context "when search and filter results are found" do it "renders table caption including the search results and total" do - expect(result.to_html).to eq("\n 2 users matching search and filters\n\n") + expect(result.to_html).to eq("\n 2 users matching search and filters
\n
\n") end end @@ -19,7 +19,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do let(:filters_count) { nil } it "renders table caption including the search results and total" do - expect(result.to_html).to eq("\n 2 users matching search\n\n") + expect(result.to_html).to eq("\n 2 users matching search
\n
\n") end end @@ -27,7 +27,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do let(:searched) { nil } it "renders table caption including the search results and total" do - expect(result.to_html).to eq("\n 2 users matching filters\n\n") + expect(result.to_html).to eq("\n 2 users matching filters
\n
\n") end end @@ -36,7 +36,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do let(:filters_count) { nil } it "renders table caption with total count only" do - expect(result.to_html).to eq("\n #{count} matching #{item}\n\n") + expect(result.to_html).to eq("\n \n 2 matching schemes\n \n\n") end end @@ -44,7 +44,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do let(:count) { 0 } it "renders table caption with total count only" do - expect(result.to_html).to eq("\n 0 users matching search and filters\n\n") + expect(result.to_html).to eq("\n 0 users matching search and filters
\n
\n") end end @@ -52,7 +52,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do let(:count) { 1 } it "renders table caption with total count only" do - expect(result.to_html).to eq("\n 1 user matching search and filters\n\n") + expect(result.to_html).to eq("\n 1 user matching search and filters
\n
\n") end end end