diff --git a/app/views/components/_published_dates.html.erb b/app/views/components/_published_dates.html.erb
index 8f2b370a2e..eca22e07fe 100644
--- a/app/views/components/_published_dates.html.erb
+++ b/app/views/components/_published_dates.html.erb
@@ -1,46 +1,50 @@
-<% add_app_component_stylesheet("published-dates") %>
<%
+ add_app_component_stylesheet("published-dates")
+
published ||= false
history ||= []
history = Array(history)
last_updated ||= false
link_to_history ||= false
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
- classes = %w(app-c-published-dates)
- classes << "app-c-published-dates--history" if history.any?
- classes << shared_helper.get_margin_bottom if local_assigns[:margin_bottom]
+
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
+ component_helper.add_class("app-c-published-dates")
+ component_helper.add_class("app-c-published-dates--history") if history.any?
+ component_helper.set_id("full-publication-update-history") if history.any?
+ component_helper.add_data_attribute({ module: "gem-toggle" }) if history.any?
+ component_helper.set_lang("en")
%>
<% if published || last_updated %>
-
<% end %>
diff --git a/app/views/components/docs/published_dates.yml b/app/views/components/docs/published_dates.yml
index 0aef1bd74e..382fbc1936 100644
--- a/app/views/components/docs/published_dates.yml
+++ b/app/views/components/docs/published_dates.yml
@@ -8,6 +8,7 @@ accessibility_criteria: |
- be usable with a keyboard
shared_accessibility_criteria:
- link
+uses_component_wrapper_helper: true
examples:
default:
data:
@@ -40,9 +41,3 @@ examples:
- display_time: 14th October 2000
note: Updated information on pupil premium reviews and what information schools need to publish on their websites.
timestamp: 2000-10-14T15:42:37.000+00:00
- with_custom_margin_bottom:
- description: |
- The component accepts a number for margin bottom from 0 to 9 (0px to 60px) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). By default, the component does not have a bottom margin.
- data:
- published: 1st January 1990
- margin_bottom: 8
diff --git a/spec/components/published_dates_spec.rb b/spec/components/published_dates_spec.rb
index 97d6591a9e..1e99c2e46c 100644
--- a/spec/components/published_dates_spec.rb
+++ b/spec/components/published_dates_spec.rb
@@ -15,9 +15,9 @@ def component_name
it "renders published date and last updated date" do
render_component(published: "1st November 2000", last_updated: "15th July 2015")
- expect(rendered).to have_css(".app-c-published-dates",
- text: "Published 1st November 2000
- Last updated 15th July 2015")
+ assert_select ".app-c-published-dates", text: "Updates to this page
+ Published 1st November 2000
+ Last updated 15th July 2015"
end
it "links to full page history" do