diff --git a/lib/govuk_publishing_components/presenters/page_with_step_by_step_navigation.rb b/lib/govuk_publishing_components/presenters/page_with_step_by_step_navigation.rb index 8b0e35b911..fcc5f63e0c 100644 --- a/lib/govuk_publishing_components/presenters/page_with_step_by_step_navigation.rb +++ b/lib/govuk_publishing_components/presenters/page_with_step_by_step_navigation.rb @@ -30,7 +30,8 @@ def show_header? end def show_related_links? - step_navs.any? && (step_navs.count < 5 || active_step_by_step?) + return true if active_step_by_step? + step_navs.any? && step_navs.count < 5 end def show_also_part_of_step_nav? diff --git a/spec/lib/presenters/page_with_step_by_step_navigation_spec.rb b/spec/lib/presenters/page_with_step_by_step_navigation_spec.rb index 6ff6fd27a7..570a7d95c0 100644 --- a/spec/lib/presenters/page_with_step_by_step_navigation_spec.rb +++ b/spec/lib/presenters/page_with_step_by_step_navigation_spec.rb @@ -381,6 +381,24 @@ expect(step_nav_helper.active_step_by_step?).to eq(false) expect(step_nav_helper.show_also_part_of_step_nav?).to be false end + + it "shows header for related to step nav when a step by step is active" do + step_nav = { + "content_id" => "cccc-dddd", + "title" => "Learn to spacewalk: small step by giant leap", + "base_path" => "/learn-to-spacewalk" + } + content_item = { + "title" => "Book a session in the vomit comet", + "document_type" => "transaction", + "links" => { + "related_to_step_navs" => [step_nav], + } + } + step_nav_helper = described_class.new(content_item, "/driving-lessons-learning-to-drive", "step-by-step-nav" => "cccc-dddd") + expect(step_nav_helper.active_step_by_step?).to eq(true) + expect(step_nav_helper.show_header?).to eq(true) + end end def payload_for(schema, content_item)