diff --git a/app/presenters/html_publication_presenter.rb b/app/presenters/html_publication_presenter.rb index 501b2555f..0595ad9ec 100644 --- a/app/presenters/html_publication_presenter.rb +++ b/app/presenters/html_publication_presenter.rb @@ -2,6 +2,7 @@ class HtmlPublicationPresenter < ContentItemPresenter include ContentItem::Body include ContentItem::OrganisationBranding include ContentItem::ContentsList + include ContentItem::Political def isbn content_item["details"]["isbn"] diff --git a/app/views/content_items/html_publication.html.erb b/app/views/content_items/html_publication.html.erb index bf6f42da6..57bc17c73 100644 --- a/app/views/content_items/html_publication.html.erb +++ b/app/views/content_items/html_publication.html.erb @@ -42,6 +42,7 @@

<%= @content_item.last_changed %>

<% end %> +<%= render 'shared/history_notice', content_item: @content_item %> <%= render 'govuk_publishing_components/components/notice', @content_item.withdrawal_notice_component %>
- <%= render 'components/banner', text: t("shared.historically_political", government: content_item.publishing_government) %> + <%= render "govuk_publishing_components/components/notice", { + title: t("shared.historically_political", government: content_item.publishing_government), + } %> <% end %> diff --git a/test/integration/detailed_guide_test.rb b/test/integration/detailed_guide_test.rb index eeeb0e055..7b7adec9e 100644 --- a/test/integration/detailed_guide_test.rb +++ b/test/integration/detailed_guide_test.rb @@ -39,7 +39,7 @@ class DetailedGuideTest < ActionDispatch::IntegrationTest test "historically political detailed guide" do setup_and_visit_content_item("political_detailed_guide") - within ".app-c-banner" do + within ".govuk-notification-banner__content" do assert page.has_text?("This was published under the 2010 to 2015 Conservative and Liberal Democrat coalition government") end end diff --git a/test/integration/document_collection_test.rb b/test/integration/document_collection_test.rb index 3e6df717b..11bdf403c 100644 --- a/test/integration/document_collection_test.rb +++ b/test/integration/document_collection_test.rb @@ -148,7 +148,7 @@ class DocumentCollectionTest < ActionDispatch::IntegrationTest test "historically political collection" do setup_and_visit_content_item("document_collection_political") - within ".app-c-banner" do + within ".govuk-notification-banner__content" do assert page.has_text?("This was published under the 2010 to 2015 Conservative and Liberal Democrat coalition government") end end diff --git a/test/integration/html_publication_test.rb b/test/integration/html_publication_test.rb index 02b3b6d59..f3e7e4c53 100644 --- a/test/integration/html_publication_test.rb +++ b/test/integration/html_publication_test.rb @@ -74,6 +74,14 @@ def assert_has_component_organisation_logo_with_brand(brand, index = 1) end end + test "historically political html publication" do + setup_and_visit_html_publication("published_with_history_mode") + + within ".govuk-notification-banner__content" do + assert page.has_text?("This was published under the 2010 to 2015 Conservative and Liberal Democrat coalition government") + end + end + test "withdrawn html publication" do content_item = GovukSchemas::Example.find("html_publication", example_name: "prime_ministers_office") content_item["withdrawn_notice"] = { diff --git a/test/integration/news_article_test.rb b/test/integration/news_article_test.rb index c7f6fca6c..7b192f3ac 100644 --- a/test/integration/news_article_test.rb +++ b/test/integration/news_article_test.rb @@ -38,7 +38,7 @@ class NewsArticleTest < ActionDispatch::IntegrationTest test "renders history notice" do setup_and_visit_content_item("news_article_history_mode") - within ".app-c-banner" do + within ".govuk-notification-banner__content" do assert page.has_text?("This was published under the 2010 to 2015 Conservative and Liberal Democrat coalition government") end end diff --git a/test/integration/publication_test.rb b/test/integration/publication_test.rb index 6568592c2..07b4b4d06 100644 --- a/test/integration/publication_test.rb +++ b/test/integration/publication_test.rb @@ -59,7 +59,7 @@ class PublicationTest < ActionDispatch::IntegrationTest test "historically political publication" do setup_and_visit_content_item("political_publication") - within ".app-c-banner" do + within ".govuk-notification-banner__content" do assert page.has_text?("This was published under the 2010 to 2015 Conservative and Liberal Democrat coalition government") end end diff --git a/test/integration/statistical_data_set_test.rb b/test/integration/statistical_data_set_test.rb index eeb5212ce..7bf27ceb8 100644 --- a/test/integration/statistical_data_set_test.rb +++ b/test/integration/statistical_data_set_test.rb @@ -35,7 +35,7 @@ class StatisticalDataSetTest < ActionDispatch::IntegrationTest test "historically political statistical data set" do setup_and_visit_content_item("statistical_data_set_political") - within ".app-c-banner" do + within ".govuk-notification-banner__content" do assert page.has_text?("This was published under the 2010 to 2015 Conservative and Liberal Democrat coalition government") end end diff --git a/test/integration/world_location_news_article_test.rb b/test/integration/world_location_news_article_test.rb index 81afbb782..2331ffa92 100644 --- a/test/integration/world_location_news_article_test.rb +++ b/test/integration/world_location_news_article_test.rb @@ -43,7 +43,7 @@ class WorldLocationNewsArticleTest < ActionDispatch::IntegrationTest test "renders history notice" do setup_and_visit_content_item("world_location_news_article_history_mode") - within ".app-c-banner" do + within ".govuk-notification-banner__content" do assert page.has_text?("This was published under the 2010 to 2015 Conservative and Liberal Democrat coalition government") end end diff --git a/test/presenters/html_publication_presenter_test.rb b/test/presenters/html_publication_presenter_test.rb index 04a87448a..895ee858e 100644 --- a/test/presenters/html_publication_presenter_test.rb +++ b/test/presenters/html_publication_presenter_test.rb @@ -5,6 +5,10 @@ def schema_name "html_publication" end + test "includes political" do + assert presented_item("published").is_a?(ContentItem::Political) + end + test "presents the basic details of a content item" do assert_equal schema_item("published")["schema_name"], presented_item("published").schema_name assert_equal schema_item("published")["links"]["parent"][0]["document_type"], presented_item("published").format_sub_type