Browse Source

feat: update link indentation and spec

pull/2083/head
natdeanlewissoftwire 2 years ago
parent
commit
3b9d715643
  1. 12
      app/components/search_result_caption_component.html.erb
  2. 12
      spec/components/search_result_caption_component_spec.rb

12
app/components/search_result_caption_component.html.erb

@ -1,11 +1,13 @@
<span class="govuk-!-margin-right-4"> <span>
<% if searched.present? && filters_count&.positive? %> <% if searched.present? && filters_count&.positive? %>
<strong><%= count %></strong> <%= item_label.pluralize(count) %> matching search and filters <strong><%= count %></strong> <%= item_label.pluralize(count) %> matching search and filters<br>
<% elsif searched.present? %> <% elsif searched.present? %>
<strong><%= count %></strong> <%= item_label.pluralize(count) %> matching search <strong><%= count %></strong> <%= item_label.pluralize(count) %> matching search<br>
<% elsif filters_count&.positive? %> <% elsif filters_count&.positive? %>
<strong><%= count %></strong> <%= item_label.pluralize(count) %> matching filters <strong><%= count %></strong> <%= item_label.pluralize(count) %> matching filters<br>
<% else %> <% else %>
<strong><%= count %></strong> matching <%= item %> <span class="govuk-!-margin-right-4">
<strong><%= count %></strong> matching <%= item %>
</span>
<% end %> <% end %>
</span> </span>

12
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 context "when search and filter results are found" do
it "renders table caption including the search results and total" do it "renders table caption including the search results and total" do
expect(result.to_html).to eq("<span class=\"govuk-!-margin-right-4\">\n <strong>2</strong> users matching search and filters\n</span>\n") expect(result.to_html).to eq("<span>\n <strong>2</strong> users matching search and filters<br>\n</span>\n")
end end
end end
@ -19,7 +19,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do
let(:filters_count) { nil } let(:filters_count) { nil }
it "renders table caption including the search results and total" do it "renders table caption including the search results and total" do
expect(result.to_html).to eq("<span class=\"govuk-!-margin-right-4\">\n <strong>2</strong> users matching search\n</span>\n") expect(result.to_html).to eq("<span>\n <strong>2</strong> users matching search<br>\n</span>\n")
end end
end end
@ -27,7 +27,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do
let(:searched) { nil } let(:searched) { nil }
it "renders table caption including the search results and total" do it "renders table caption including the search results and total" do
expect(result.to_html).to eq("<span class=\"govuk-!-margin-right-4\">\n <strong>2</strong> users matching filters\n</span>\n") expect(result.to_html).to eq("<span>\n <strong>2</strong> users matching filters<br>\n</span>\n")
end end
end end
@ -36,7 +36,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do
let(:filters_count) { nil } let(:filters_count) { nil }
it "renders table caption with total count only" do it "renders table caption with total count only" do
expect(result.to_html).to eq("<span class=\"govuk-!-margin-right-4\">\n <strong>#{count}</strong> matching #{item}\n</span>\n") expect(result.to_html).to eq("<span>\n <span class=\"govuk-!-margin-right-4\">\n <strong>2</strong> matching schemes\n </span>\n</span>\n")
end end
end end
@ -44,7 +44,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do
let(:count) { 0 } let(:count) { 0 }
it "renders table caption with total count only" do it "renders table caption with total count only" do
expect(result.to_html).to eq("<span class=\"govuk-!-margin-right-4\">\n <strong>0</strong> users matching search and filters\n</span>\n") expect(result.to_html).to eq("<span>\n <strong>0</strong> users matching search and filters<br>\n</span>\n")
end end
end end
@ -52,7 +52,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do
let(:count) { 1 } let(:count) { 1 }
it "renders table caption with total count only" do it "renders table caption with total count only" do
expect(result.to_html).to eq("<span class=\"govuk-!-margin-right-4\">\n <strong>1</strong> user matching search and filters\n</span>\n") expect(result.to_html).to eq("<span>\n <strong>1</strong> user matching search and filters<br>\n</span>\n")
end end
end end
end end

Loading…
Cancel
Save