diff --git a/app/views/shared/_history_notice.html.erb b/app/views/shared/_history_notice.html.erb index dd4d7bd11..91becded0 100644 --- a/app/views/shared/_history_notice.html.erb +++ b/app/views/shared/_history_notice.html.erb @@ -1,5 +1,8 @@ <% if content_item.historically_political? %> <%= render "govuk_publishing_components/components/notice", { - title: t("shared.historically_political", government: content_item.publishing_government), + title: sanitize( + t("shared.historically_political", government: "#{content_item.publishing_government}"), + attributes: %w(lang dir), + ), } %> <% end %> diff --git a/test/integration/news_article_test.rb b/test/integration/news_article_test.rb index d04e5583b..c2ed0c80c 100644 --- a/test/integration/news_article_test.rb +++ b/test/integration/news_article_test.rb @@ -42,6 +42,14 @@ class NewsArticleTest < ActionDispatch::IntegrationTest end end + test "marks up government name correctly" do + setup_and_visit_content_item("news_article_history_mode_translated_arabic") + + within ".govuk-notification-banner__content" do + assert page.has_css?("span[lang='en'][dir='ltr']", text: "2022 to 2024 Sunak Conservative government") + end + end + test "does not render with the single page notification button" do setup_and_visit_content_item("news_article") assert_not page.has_css?(".gem-c-single-page-notification-button")