diff --git a/app/views/components/_contents_list_with_body.html.erb b/app/views/components/_contents_list_with_body.html.erb index b8659b4db..188ac6ade 100644 --- a/app/views/components/_contents_list_with_body.html.erb +++ b/app/views/components/_contents_list_with_body.html.erb @@ -3,9 +3,15 @@ <% unless block.empty? %> <% contents ||= [] - sticky_attr = ' data-module="sticky-element-container"'.html_safe if contents.any? + sticky_attr = "sticky-element-container" if contents.any? %> -
> + <%= tag.div( + id: "contents", + class: "app-c-contents-list-with-body", + data: { + module: sticky_attr, + }, + ) do %> <% if contents.any? %>
<%= render 'govuk_publishing_components/components/contents_list', contents: contents %> @@ -19,5 +25,5 @@
<% end %> - + <% end %> <% end %> diff --git a/app/views/components/_important_metadata.html.erb b/app/views/components/_important_metadata.html.erb index 2d6ded5c5..1ffdc9f04 100644 --- a/app/views/components/_important_metadata.html.erb +++ b/app/views/components/_important_metadata.html.erb @@ -3,7 +3,7 @@ title = local_assigns[:title] items = local_assigns[:items] || {} items = items.reject { |k,v| v.nil? } - items = items.merge(items) { |k,v| Array(v).join(", ").html_safe } + items = items.merge(items) { |k,v| Array(v).join(", ") } margin_bottom_class = " app-c-important-metadata--bottom-margin" unless local_assigns[:margin_bottom] -%> <% if items.any? %> diff --git a/app/views/components/docs/contents_list_with_body.yml b/app/views/components/docs/contents_list_with_body.yml index 9e1a76c06..9094b27e0 100644 --- a/app/views/components/docs/contents_list_with_body.yml +++ b/app/views/components/docs/contents_list_with_body.yml @@ -79,10 +79,10 @@ examples:

Contact

Please send written representations about any competition issues to:

-
Competition and Markets Authority -
Victoria House -
Southampton Row -
London +
Competition and Markets Authority +
Victoria House +
Southampton Row +
London
WC1B 4AD

diff --git a/app/views/components/docs/important_metadata.yml b/app/views/components/docs/important_metadata.yml index 5b290489a..49f87725d 100644 --- a/app/views/components/docs/important_metadata.yml +++ b/app/views/components/docs/important_metadata.yml @@ -24,9 +24,9 @@ examples: data: items: Many things: - - First thing - - Second thing - - Third thing + - First thing + - Second thing + - Third thing with_title: description: Used on statistics announcements to display release date changed information, [see example](https://gov.uk/government/statistics/announcements/museums-and-galleries-monthly-visits--8) data: diff --git a/test/components/all_components_test.rb b/test/components/all_components_test.rb index 00b65f81a..237244aad 100644 --- a/test/components/all_components_test.rb +++ b/test/components/all_components_test.rb @@ -47,10 +47,10 @@ class AllComponentsTest < ActionController::TestCase assert File.exist?(css_file) end - should "not use `html_safe`", not_applicable: component_name.in?(%w[govspeak]) do + should "not use `html_safe`" do file = File.read(filename) - assert_no_match file, "html_safe" + assert_no_match "html_safe", file end end end