Skip to content

Commit

Permalink
Add heading level to section title
Browse files Browse the repository at this point in the history
  • Loading branch information
catalinailie committed Jan 15, 2025
1 parent 8b135c6 commit 4379865
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/views/content_items/hmrc_manual.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<% @content_item.section_groups.each do |group| %>
<% next unless group["child_sections"].present? %>
<div class="subsection-collection">
<%= render "content_items/manuals/hmrc_sections", group: group %>
<%= render "content_items/manuals/hmrc_sections", group: group, heading: 3 %>
</div>
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/content_items/hmrc_manual_section.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<% @content_item.section_groups.each do | group | %>
<div class="subsection-collection govuk-grid-column-full">
<%= render "content_items/manuals/hmrc_sections", group: group %>
<%= render "content_items/manuals/hmrc_sections", group: group, heading: 2 %>
</div>
<% end %>

Expand Down
7 changes: 6 additions & 1 deletion app/views/content_items/manuals/_hmrc_sections.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<% if group["title"] %>
<%= group["title"] %>
<%= render "govuk_publishing_components/components/heading", {
text: group["title"],
font_size: "m",
heading_level: heading,
margin_bottom: 4,
} %>
<% end %>

<ol class="section-list hmrc">
Expand Down
6 changes: 6 additions & 0 deletions test/integration/hmrc_manual_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 4379865

Please sign in to comment.