diff --git a/app/views/components/_related-navigation.html.erb b/app/views/components/_related-navigation.html.erb index 43319e7e85..ac2e570d56 100644 --- a/app/views/components/_related-navigation.html.erb +++ b/app/views/components/_related-navigation.html.erb @@ -1,8 +1,10 @@ <% max_section_length = 5 - defined_sections = %w(topics publishers collections policies topical_events world_locations statistical_data_sets) + defined_sections = %w(related_guides topics publishers collections policies + topical_events world_locations statistical_data_sets) related_content = [ {"related_items" => related_items ||= [] }, + {"related_guides" => related_guides ||= [] }, {"topics" => topics ||= [] }, {"publishers" => publishers ||= [] }, {"collections" => collections ||= [] }, diff --git a/config/locales/en.yml b/config/locales/en.yml index 9efdee554a..a1686152a6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -33,6 +33,7 @@ en: policies: "Policy" publishers: "Published by" related_content: "Related content" + related_guides: "Detailed guidance" statistical_data_sets: "Statistical data set" topics: "Explore the topic" topical_events: "Topical event" diff --git a/test/components/related_navigation_test.rb b/test/components/related_navigation_test.rb index 23550206b4..e70dfd2f22 100644 --- a/test/components/related_navigation_test.rb +++ b/test/components/related_navigation_test.rb @@ -23,6 +23,20 @@ def component_name assert_select ".app-c-related-navigation__section-link--other[href=\"/apprenticeships\"]", text: 'Apprenticeships' end + test "renders related guides section when passed related guides" do + render_component( + related_guides: [ + { + text: "Some other guidance", + path: '/something-a-bit-like-this' + } + ] + ) + + assert_select ".app-c-related-navigation__sub-heading", text: 'Detailed guidance' + assert_select ".app-c-related-navigation__section-link[href=\"/something-a-bit-like-this\"]", text: 'Some other guidance' + end + test "renders topics section when passed topic items" do render_component( topics: [