From 6a35c5d0c9d58d1d6e27c6ad49a0863c57fa152a Mon Sep 17 00:00:00 2001 From: Catalina Ilie Date: Wed, 4 Dec 2024 14:55:16 +0000 Subject: [PATCH] Add heading level to section title --- app/views/content_items/hmrc_manual.html.erb | 2 +- app/views/content_items/hmrc_manual_section.html.erb | 2 +- app/views/content_items/manuals/_hmrc_sections.html.erb | 7 ++++++- test/integration/hmrc_manual_test.rb | 6 ++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/views/content_items/hmrc_manual.html.erb b/app/views/content_items/hmrc_manual.html.erb index d5de462e5..7f0a656cb 100644 --- a/app/views/content_items/hmrc_manual.html.erb +++ b/app/views/content_items/hmrc_manual.html.erb @@ -13,7 +13,7 @@ <% @content_item.section_groups.each do |group| %> <% next unless group["child_sections"].present? %>
- <%= render "content_items/manuals/hmrc_sections", group: group %> + <%= render "content_items/manuals/hmrc_sections", group: group, heading_level: 3 %>
<% end %> <% end %> diff --git a/app/views/content_items/hmrc_manual_section.html.erb b/app/views/content_items/hmrc_manual_section.html.erb index b3f82e6bd..4a424c7c5 100644 --- a/app/views/content_items/hmrc_manual_section.html.erb +++ b/app/views/content_items/hmrc_manual_section.html.erb @@ -21,7 +21,7 @@ <% @content_item.section_groups.each do | group | %>
- <%= render "content_items/manuals/hmrc_sections", group: group %> + <%= render "content_items/manuals/hmrc_sections", group: group, heading_level: 2 %>
<% end %> diff --git a/app/views/content_items/manuals/_hmrc_sections.html.erb b/app/views/content_items/manuals/_hmrc_sections.html.erb index eca5cadca..34f5c156f 100644 --- a/app/views/content_items/manuals/_hmrc_sections.html.erb +++ b/app/views/content_items/manuals/_hmrc_sections.html.erb @@ -1,5 +1,10 @@ <% if group["title"] %> - <%= group["title"] %> + <%= render "govuk_publishing_components/components/heading", { + text: group["title"], + font_size: "m", + heading_level:, + margin_bottom: 4, + } %> <% end %>
    diff --git a/test/integration/hmrc_manual_test.rb b/test/integration/hmrc_manual_test.rb index a1680b4d2..fa87c2df7 100644 --- a/test/integration/hmrc_manual_test.rb +++ b/test/integration/hmrc_manual_test.rb @@ -54,6 +54,12 @@ class HmrcManualTest < ActionDispatch::IntegrationTest assert page.has_selector?("h2", text: I18n.t("manuals.contents_title")) end + test "renders sections title heading" do + setup_and_visit_content_item("vat-government-public-bodies") + + assert page.has_selector?("h3", text: "Historic updates") + end + test "renders section groups" do setup_and_visit_content_item("vat-government-public-bodies")