diff --git a/Gemfile b/Gemfile index e548b609b..fd0e6e94f 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,7 @@ gem 'gds-api-adapters', '~> 52.5' gem 'govuk_ab_testing', '~> 2.4' gem 'govuk_app_config', '~> 1.5' gem 'govuk_frontend_toolkit', '~> 7.4' -gem 'govuk_publishing_components', '~> 9.1.0' +gem 'govuk_publishing_components', '~> 9.2.0' gem 'plek', '~> 2.1' gem 'slimmer', '~> 12.1' diff --git a/Gemfile.lock b/Gemfile.lock index f6fef6eba..6870ade58 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -93,7 +93,7 @@ GEM i18n (>= 0.7) faraday (0.15.2) multipart-post (>= 1.2, < 3) - ffi (1.9.23) + ffi (1.9.25) gds-api-adapters (52.5.1) addressable link_header @@ -127,7 +127,7 @@ GEM govuk_frontend_toolkit (7.5.0) railties (>= 3.1.0) sass (>= 3.2.0) - govuk_publishing_components (9.1.0) + govuk_publishing_components (9.2.0) govspeak (>= 5.0.3) govuk_app_config govuk_frontend_toolkit @@ -368,7 +368,7 @@ DEPENDENCIES govuk_ab_testing (~> 2.4) govuk_app_config (~> 1.5) govuk_frontend_toolkit (~> 7.4) - govuk_publishing_components (~> 9.1.0) + govuk_publishing_components (~> 9.2.0) govuk_schemas (~> 3.1) htmlentities (~> 4.3) jasmine-rails diff --git a/app/presenters/content_item/organisation_branding.rb b/app/presenters/content_item/organisation_branding.rb index 2e827ec2f..17a8c8a24 100644 --- a/app/presenters/content_item/organisation_branding.rb +++ b/app/presenters/content_item/organisation_branding.rb @@ -6,7 +6,7 @@ def organisation_logo(organisation = default_organisation) logo = organisation["details"]["logo"] logo_component_params = { organisation: { - name: logo["formatted_title"], + name: logo["formatted_title"].html_safe, url: organisation["base_path"], brand: organisation_brand(organisation), crest: logo["crest"], diff --git a/app/views/content_items/corporate_information_page.html.erb b/app/views/content_items/corporate_information_page.html.erb index 90fb7f188..7a6273160 100644 --- a/app/views/content_items/corporate_information_page.html.erb +++ b/app/views/content_items/corporate_information_page.html.erb @@ -29,7 +29,7 @@
- <%= render 'govuk_component/organisation_logo', @content_item.organisation_logo %> + <%= render 'govuk_publishing_components/components/organisation_logo', @content_item.organisation_logo %>
diff --git a/app/views/content_items/html_publication.html.erb b/app/views/content_items/html_publication.html.erb index 9cee9496d..6a4723107 100644 --- a/app/views/content_items/html_publication.html.erb +++ b/app/views/content_items/html_publication.html.erb @@ -8,15 +8,17 @@ content_for :simple_header, true %> -
-
    - <% @content_item.organisations.each do |organisation| %> - - <% end %> -
-
+<% if @content_item.organisations %> +
+
    + <% @content_item.organisations.each do |organisation| %> + + <% end %> +
+
+<% end %> <%= render 'govuk_publishing_components/components/inverse_header', {} do %> <%= render 'govuk_publishing_components/components/title', diff --git a/test/integration/corporate_information_page_test.rb b/test/integration/corporate_information_page_test.rb index c236133fa..3212678a4 100644 --- a/test/integration/corporate_information_page_test.rb +++ b/test/integration/corporate_information_page_test.rb @@ -65,30 +65,12 @@ class CorporateInformationPageTest < ActionDispatch::IntegrationTest test "renders an organisation logo" do setup_and_visit_content_item('corporate_information_page') - assert_has_component_organisation_logo( - organisation: { - name: 'Department
of Health', - url: '/government/organisations/department-of-health', - brand: 'department-of-health', - crest: 'single-identity' - } - ) + assert_has_component_organisation_logo end test "renders a custom organisation logo" do setup_and_visit_content_item('corporate_information_page_translated_custom_logo') - assert_has_component_organisation_logo( - organisation: { - name: 'Land Registry', - url: '/government/organisations/land-registry', - brand: 'department-for-business-innovation-skills', - crest: nil, - image: { - url: 'https://assets.publishing.service.gov.uk/government/uploads/system/uploads/organisation/logo/69/LR_logo_265.png', - alt_text: 'Land Registry' - } - } - ) + assert_has_component_organisation_logo end test 'renders a withdrawal notice on withdrawn page' do diff --git a/test/integration/html_publication_test.rb b/test/integration/html_publication_test.rb index bb4c9fe18..7b075a073 100644 --- a/test/integration/html_publication_test.rb +++ b/test/integration/html_publication_test.rb @@ -20,10 +20,6 @@ class HtmlPublicationTest < ActionDispatch::IntegrationTest assert page.has_css?('.gem-c-contents-list') end - within ".organisation-logos" do - assert page.has_text?(@content_item["links"]["organisations"][0]["title"]) - end - assert page.has_text?("The Environment Agency will normally put any responses it receives on the public register. This includes your name and contact details. Tell us if you don’t want your response to be public.") end @@ -78,8 +74,8 @@ class HtmlPublicationTest < ActionDispatch::IntegrationTest end def assert_has_component_organisation_logo_with_brand(brand, index = 1) - within("li.organisation-logo:nth-of-type(#{index}) #{shared_component_selector('organisation_logo')}") do - assert_equal brand, JSON.parse(page.text).fetch("organisation").fetch("brand") + within("li.organisation-logo:nth-of-type(#{index})") do + assert page.has_css?(".gem-c-organisation-logo.brand--#{brand}") end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 6aff2fc3c..1a3a20746 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -81,10 +81,8 @@ def assert_has_component_title(title) assert page.has_css?('h1', text: title) end - def assert_has_component_organisation_logo(logo, index = 1) - within(shared_component_selector("organisation_logo") + ":nth-of-type(#{index})") do - assert_equal logo, JSON.parse(page.text).deep_symbolize_keys - end + def assert_has_component_organisation_logo + assert page.has_css?(".gem-c-organisation-logo") end def assert_has_component_government_navigation_active(active)