From 4b96606459fd6f60b8b0a64faba8453c8811b73a Mon Sep 17 00:00:00 2001 From: Patrick Cartlidge Date: Tue, 28 Nov 2023 16:21:42 +0000 Subject: [PATCH] Remove reference to details.js As of govuk-frontend v5, the details component does not use JS and the .js file has been removed from the package. Remove the `data-module="govuk-details"` attribute See 'Remove references to the JavaScript for the Details component' from https://github.com/alphagov/govuk-frontend/releases/tag/v5.0.0 --- .../govuk_publishing_components/components/details.js | 2 -- .../govuk_publishing_components/components/_details.html.erb | 4 ++-- spec/components/details_spec.rb | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/govuk_publishing_components/components/details.js b/app/assets/javascripts/govuk_publishing_components/components/details.js index 67345e0020..dcd6bf98ea 100644 --- a/app/assets/javascripts/govuk_publishing_components/components/details.js +++ b/app/assets/javascripts/govuk_publishing_components/components/details.js @@ -1,7 +1,5 @@ -// = require govuk/components/details/details.bundle.js window.GOVUK = window.GOVUK || {} window.GOVUK.Modules = window.GOVUK.Modules || {} -window.GOVUK.Modules.GovukDetails = window.GOVUKFrontend.Details; (function (Modules) { function GemDetails ($module) { diff --git a/app/views/govuk_publishing_components/components/_details.html.erb b/app/views/govuk_publishing_components/components/_details.html.erb index ed50663b9e..3f4f347604 100644 --- a/app/views/govuk_publishing_components/components/_details.html.erb +++ b/app/views/govuk_publishing_components/components/_details.html.erb @@ -13,8 +13,8 @@ css_classes << shared_helper.get_margin_bottom details_data_attributes = {} - details_data_attributes[:module] = 'govuk-details gem-details' - details_data_attributes[:module] = 'govuk-details gem-details ga4-event-tracker' unless disable_ga4 + details_data_attributes[:module] = 'gem-details' + details_data_attributes[:module] = 'gem-details ga4-event-tracker' unless disable_ga4 data_attributes ||= {} data_attributes[:details_track_click] = '' diff --git a/spec/components/details_spec.rb b/spec/components/details_spec.rb index 72b36daac6..f55c91b54f 100644 --- a/spec/components/details_spec.rb +++ b/spec/components/details_spec.rb @@ -10,7 +10,7 @@ def component_name "This is more info" end - assert_select "details.gem-c-details[data-module='govuk-details gem-details ga4-event-tracker']" + assert_select "details.gem-c-details[data-module='gem-details ga4-event-tracker']" assert_select ".govuk-details__summary-text[data-ga4-expandable]", text: "Some title" assert_select ".govuk-details__text", text: "This is more info" end