diff --git a/Gemfile b/Gemfile index a45ae9588..4c6f8fb72 100644 --- a/Gemfile +++ b/Gemfile @@ -17,8 +17,8 @@ gem 'gds-api-adapters', '~> 52.2' gem 'govuk_ab_testing', '~> 2.4' gem 'govuk_app_config', '~> 1.3' gem 'govuk_frontend_toolkit', '~> 7.4' -gem 'govuk_navigation_helpers', '~> 9.2' -gem 'govuk_publishing_components', '~> 5.5' +gem 'govuk_navigation_helpers', '~> 9.2.1' +gem 'govuk_publishing_components', '~> 5.7.0' gem 'plek', '~> 2.1' gem 'slimmer', '~> 12.0' diff --git a/Gemfile.lock b/Gemfile.lock index 29f996300..24188cbda 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -365,8 +365,8 @@ DEPENDENCIES govuk_ab_testing (~> 2.4) govuk_app_config (~> 1.3) govuk_frontend_toolkit (~> 7.4) - govuk_navigation_helpers (~> 9.2) - govuk_publishing_components (~> 5.5) + govuk_navigation_helpers (~> 9.2.1) + govuk_publishing_components (~> 5.7.0) govuk_schemas (~> 3.1) htmlentities (~> 4.3) jasmine-rails diff --git a/app/assets/stylesheets/components/_publication-header.scss b/app/assets/stylesheets/components/_publication-header.scss deleted file mode 100644 index e7c9c53ec..000000000 --- a/app/assets/stylesheets/components/_publication-header.scss +++ /dev/null @@ -1,11 +0,0 @@ -.app-c-publication-header { - @include core-19; - color: $white; - background: $govuk-blue; - padding: ($gutter / 2) $gutter $gutter; - margin-bottom: $gutter * 2; -} - -.app-c-publication-header__last-changed { - margin-top: $gutter / 2; -} diff --git a/app/assets/stylesheets/views/_html-publication.scss b/app/assets/stylesheets/views/_html-publication.scss index 9f6fda104..9eeec0659 100644 --- a/app/assets/stylesheets/views/_html-publication.scss +++ b/app/assets/stylesheets/views/_html-publication.scss @@ -28,6 +28,11 @@ } } + .publication-header__last-changed { + @include core-19; + margin-top: $gutter-half; + } + .column-quarter-desktop-only { @include grid-column( 1 / 4, $full-width: desktop ); diff --git a/app/views/components/_publication-header.html.erb b/app/views/components/_publication-header.html.erb deleted file mode 100644 index 05d8bb148..000000000 --- a/app/views/components/_publication-header.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -
- <%= render partial: 'govuk_component/title', locals: { - title: title, - context: context, - inverse: true, - margin_bottom: 0 - } %> -

<%= last_changed %>

-
diff --git a/app/views/components/docs/publication-header.yml b/app/views/components/docs/publication-header.yml deleted file mode 100644 index 3f5330652..000000000 --- a/app/views/components/docs/publication-header.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Publication Header -description: A page header, currently used on HTML Publication pages. -body: | - Real world example: [HTML Publication with header](/government/publications/budget-2016-documents/budget-2016) -accessibility_criteria: | - The header must: - - - be visually distinct from other content on the page - - have a text contrast ratio higher than 4.5:1 against the background colour to meet [WCAG AA](https://www.w3.org/TR/WCAG20/#visual-audio-contrast-contrast) -examples: - default: - data: - title: 'Budget 2016' - context: 'Policy Paper' - last_changed: 'Updated 16 March 2016' diff --git a/app/views/content_items/html_publication.html.erb b/app/views/content_items/html_publication.html.erb index 055e41bec..1f77d5ef3 100644 --- a/app/views/content_items/html_publication.html.erb +++ b/app/views/content_items/html_publication.html.erb @@ -12,7 +12,15 @@ -<%= render 'components/publication-header', title: @content_item.title, context: I18n.t("content_item.schema_name.#{@content_item.format_sub_type}", count: 1), last_changed: @content_item.last_changed %> +<%= render 'govuk_publishing_components/components/inverse_header', {} do %> + <%= render 'govuk_component/title', + title: @content_item.title, + context: I18n.t("content_item.schema_name.#{@content_item.format_sub_type}", count: 1), + inverse: true, + margin_bottom: 0 + %> +

<%= @content_item.last_changed %>

+<% end %> <%= render 'components/notice', @content_item.withdrawal_notice_component %> diff --git a/test/components/publication_header_test.rb b/test/components/publication_header_test.rb deleted file mode 100644 index bf665e4cb..000000000 --- a/test/components/publication_header_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -require 'component_test_helper' - -class PublicationHeaderTest < ComponentTestCase - def component_name - "publication-header" - end - - test "fails to render a publication-header when no properties are supplied" do - assert_raise do - render_component({}) - end - end -end - -# This component renders some content using the static title component, which cannot currently be tested using the approach above. -# To cover this gap, below is an integration test that loads the publication header page in the component guide in order to test -# that the remaining aspects of the component are being rendered correctly. - -class PublicationHeaderTitleTest < ActionDispatch::IntegrationTest - test "renders a publication header" do - visit '/component-guide/publication-header/default' - - within '.component-guide-preview' do - assert page.has_selector?(".app-c-publication-header") - end - end - - test "renders a publication header with a title" do - visit '/component-guide/publication-header/default' - - within '.component-guide-preview' do - assert_has_component_title("Budget 2016") - end - end - - test "renders a publication header with last changed date" do - visit '/component-guide/publication-header/default' - - within '.component-guide-preview' do - assert page.has_selector?(".app-c-publication-header__last-changed", text: "Updated 16 March 2016") - end - end -end diff --git a/test/integration/html_publication_test.rb b/test/integration/html_publication_test.rb index 5800eb9d3..072a600d8 100644 --- a/test/integration/html_publication_test.rb +++ b/test/integration/html_publication_test.rb @@ -8,7 +8,7 @@ class HtmlPublicationTest < ActionDispatch::IntegrationTest test "html publications" do setup_and_visit_content_item('published') - within ".app-c-publication-header" do + within ".gem-c-inverse-header" do assert page.has_text?(@content_item["details"]["format_sub_type"]) assert page.has_text?(@content_item["title"]) @@ -67,7 +67,7 @@ class HtmlPublicationTest < ActionDispatch::IntegrationTest test "no contents are shown when headings are an empty list" do setup_and_visit_content_item("prime_ministers_office") - within ".app-c-publication-header" do + within ".gem-c-inverse-header" do refute page.has_text?("Contents") end end