Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove specialist topics from breadcrumbs #3927

Merged
merged 2 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
of the commit log.

## Unreleased

* Remove support for specialist topics from contextual navigation ie breadcrumbs ([#3927](https://github.com/alphagov/govuk_publishing_components/pull/3927))
* Improve test coverage of contextual breadcrumb logic ([PR #3944](https://github.com/alphagov/govuk_publishing_components/pull/3944) and [PR #3945](https://github.com/alphagov/govuk_publishing_components/pull/3945))
* Remove GA4 callout tracking from the govspeak component ([PR #3946](https://github.com/alphagov/govuk_publishing_components/pull/3946))
* Remove GA4 callout tracking from notice & warning text components ([PR #3947](https://github.com/alphagov/govuk_publishing_components/pull/3947))
Expand Down
1 change: 0 additions & 1 deletion lib/govuk_publishing_components.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
require "govuk_publishing_components/presenters/public_layout_helper"
require "govuk_publishing_components/presenters/content_breadcrumbs_based_on_ancestors"
require "govuk_publishing_components/presenters/content_breadcrumbs_based_on_taxons"
require "govuk_publishing_components/presenters/content_breadcrumbs_based_on_topic"
require "govuk_publishing_components/presenters/checkboxes_helper"
require "govuk_publishing_components/presenters/select_helper"
require "govuk_publishing_components/presenters/meta_tags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ def options(navigation)
step_by_step: false,
breadcrumbs: navigation.breadcrumbs,
}
elsif navigation.content_has_a_topic?
{
step_by_step: false,
breadcrumbs: navigation.topic_breadcrumbs,
}
elsif navigation.use_taxon_breadcrumbs?
{
step_by_step: false,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ def taxon_breadcrumbs
@taxon_breadcrumbs ||= ContentBreadcrumbsBasedOnTaxons.call(content_item)
end

def topic_breadcrumbs
@topic_breadcrumbs ||= ContentBreadcrumbsBasedOnTopic.call(content_item)
end

def breadcrumbs
breadcrumbs_based_on_ancestors
end
Expand Down Expand Up @@ -88,10 +84,6 @@ def content_is_a_html_publication?
content_item["document_type"] == "html_publication"
end

def content_has_a_topic?
content_item.dig("links", "topics").present?
end

def content_tagged_to_current_step_by_step?
# TODO: remove indirection here
step_nav_helper.show_header?
Expand Down
4 changes: 2 additions & 2 deletions spec/components/breadcrumbs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ def assert_link_with_text_in(selector, link, text)
it "renders breadcrumb items without link as text" do
render_component(
breadcrumbs: [
{ title: "Topic", url: "/topic" },
{ title: "Education", url: "/education" },
{ title: "Current Page" },
],
)

assert_link_with_text_in(".govuk-breadcrumbs__list-item:first-child", "/topic", "Topic")
assert_link_with_text_in(".govuk-breadcrumbs__list-item:first-child", "/education", "Education")
assert_select(".govuk-breadcrumbs__list-item:last-child", "Current Page")
assert_select(".govuk-breadcrumbs__list-item:last-child a", false)
end
Expand Down
6 changes: 0 additions & 6 deletions spec/components/contextual_breadcrumbs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ def remove_curated_related_item(content_item)
content_item
end

def remove_topics(content_item)
content_item["links"].delete("topics")
content_item
end

def set_parent_titles_to_businesses(content_item)
content_item["links"]["parent"][0]["title"] = "Business and self-employed"
content_item["links"]["parent"][0]["links"]["parent"][0]["title"] = "Licences and licence applications"
Expand Down Expand Up @@ -86,7 +81,6 @@ def set_live_taxons(content_item)
it "renders taxon breadcrumbs if the content_item is tagged to mainstream browse but there is no mainstream browse parent" do
content_item = example_document_for("guide", "guide-with-no-parent")
content_item = set_live_taxons(content_item)
remove_topics(content_item)
render_component(content_item:)
assert_no_selector(".gem-c-step-nav-header")
assert_select "a", text: "Home"
Expand Down
60 changes: 0 additions & 60 deletions spec/features/contextual_navigation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,6 @@
and_the_default_breadcrumbs
end

scenario "The page has a topic" do
given_theres_a_page_with_a_topic
and_i_visit_that_page
then_i_see_the_topic_breadcrumb
end

scenario "The page has many topics" do
given_theres_a_page_with_more_than_one_topic
and_i_visit_that_page
then_i_see_the_topic_breadcrumb
and_i_see_the_both_topics_in_the_related_navigation_footer
end

scenario "It's a HTML Publication document" do
given_there_is_a_non_step_by_step_parent_page
and_the_page_is_an_html_publication_with_that_parent
Expand Down Expand Up @@ -91,13 +78,6 @@
and_the_taxonomy_breadcrumbs
end

scenario "A browse page has a topic" do
given_theres_a_browse_page_with_a_topic
and_i_visit_that_page
then_i_see_the_topic_in_the_related_navigation_footer
and_the_default_breadcrumbs
end

scenario "There's a secondary step by step list and no primary step by step list" do
given_theres_a_page_with_a_secondary_step_by_step
and_i_visit_that_page
Expand Down Expand Up @@ -283,7 +263,6 @@ def given_theres_a_travel_advice_page
content_store_has_random_item(
schema: "travel_advice",
links: {
"topics" => [topic_item],
"parent" => [example_parent_page],
},
)
Expand All @@ -310,24 +289,6 @@ def given_theres_a_guide_with_a_live_taxon_tagged_to_it
)
end

def given_theres_a_browse_page_with_a_topic
content_store_has_random_item(links: {
"topics" => [topic_item],
"mainstream_browse_pages" => [top_level_mainstream_browse_page],
"parent" => [top_level_mainstream_browse_page],
})
end

def given_theres_a_page_with_a_topic
content_store_has_random_item(links: { "topics" => [topic_item] })
end

def given_theres_a_page_with_more_than_one_topic
content_store_has_random_item(
links: { "topics" => [topic_item, second_topic_item] },
)
end

def tag_page_to_a_taxon(*taxons)
content_store_has_random_item(
links: {
Expand Down Expand Up @@ -499,19 +460,6 @@ def then_i_see_the_taxon_in_the_related_navigation_footer
end
end

def then_i_see_the_topic_in_the_related_navigation_footer
within ".gem-c-contextual-footer" do
expect(page).to have_css(".gem-c-related-navigation__link", text: topic_item["title"])
end
end

def and_i_see_the_both_topics_in_the_related_navigation_footer
within ".gem-c-contextual-footer" do
expect(page).to have_css(".gem-c-related-navigation__link", text: topic_item["title"])
expect(page).to have_css(".gem-c-related-navigation__link", text: second_topic_item["title"])
end
end

# Use links version if output could be either step by step or breadcrumbs
def then_i_see_home_and_parent_links
within ".gem-c-contextual-breadcrumbs" do
Expand Down Expand Up @@ -572,12 +520,4 @@ def top_level_mainstream_browse_page
def taxon_item
@taxon_item ||= example_item("taxon", "taxon")
end

def topic_item
@topic_item ||= example_item("topic", "topic")
end

def second_topic_item
@second_topic_item ||= example_item("topic", "curated_subtopic")
end
end