Skip to content

Commit

Permalink
Fix breaking tests due to translation additions
Browse files Browse the repository at this point in the history
  • Loading branch information
NickColley committed Jul 22, 2016
1 parent c07c39c commit b1c881f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/views/govuk_component/document_footer.raw.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
<div class="history-information" id="history">
<% if local_assigns.include?(:published) && published %>
<p>
<%= t("govuk_component.document_footer.published", default: "Published") %>
<%= t("govuk_component.document_footer.published", default: "Published") %>:
<span class="published definition"><%= published %></span>
</p>
<% end %>
<% if local_assigns.include?(:updated) && updated %>
<p>
<%= t("govuk_component.document_footer.updated", default: "Updated") %>
<%= t("govuk_component.document_footer.updated", default: "Updated") %>:
<span class="updated definition"><%= updated %></span>
</p>
<% end %>
Expand Down
7 changes: 6 additions & 1 deletion app/views/govuk_component/related_items.raw.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
<li class="related-items-more">
<a href="<%= section[:url] %>">
<%= t("govuk_component.related_items.more", default: "More") %>
<% if section[:title] %> <span class="visuallyhidden">in <%= section[:title] %></span><% end %>
<% if section[:title] %>
<span class="visuallyhidden">
<%= t("govuk_component.related_items.in", default: "in") %>
<%= section[:title] %>
</span>
<% end %>
</a>
</li>
<% end %>
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ en:
pagination: "Pagination"
related_items:
more: "More"
in: "in"
4 changes: 2 additions & 2 deletions test/govuk_component/document_footer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def component_name
}
})

assert_select 'p', text: 'Published: 20 January 2092'
assert_select 'p', text: 'Updated: 22 January 2092'
assert_select 'p', text: /Published:\s+20 January 2092/
assert_select 'p', text: /Updated:\s+22 January 2092/
assert_select 'p', text: 'Date opened: 1 February 2092'
assert_select 'p', text: 'Date closed: 1 March 2093'
end
Expand Down
6 changes: 3 additions & 3 deletions test/govuk_component/related_items_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def component_name
})

assert_select "h2", text: "Section title"
assert_link_with_text_in("ul li:last-child", "/more-link", "More in Section title")
assert_link_with_text_in("ul li:last-child", "/more-link", /More\s+in\s+Section title/)
assert_link_with_text_in("ul li:first-child", "/item", "Item title")
assert_link_with_text_in("ul li:first-child + li", "/other-item", "Other item title")
end
Expand Down Expand Up @@ -65,11 +65,11 @@ def component_name
})

assert_select "h2", text: "Section title"
assert_link_with_text_in("ul li:last-child", "/more-link", "More in Section title")
assert_link_with_text_in("ul li:last-child", "/more-link", /More\s+in\s+Section title/)
assert_link_with_text_in("ul li:first-child", "/item", "Item title")

assert_select "h2", text: "Other section title"
assert_link_with_text_in("ul li:last-child", "/other-more-link", "More in Other section title")
assert_link_with_text_in("ul li:last-child", "/other-more-link", /More\s+in\s+Other section title/)
assert_link_with_text_in("ul li:first-child", "/other-item", "Other item title")
end

Expand Down

0 comments on commit b1c881f

Please sign in to comment.