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

Update breadcrumb tests #3944

Merged
merged 3 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,10 @@
useful summary for people upgrading their application, not a replication
of the commit log.

## Unreleased

* Improve test coverage of contextual breadcrumb logic ([PR #3944](https://github.com/alphagov/govuk_publishing_components/pull/3944))

## 37.9.1

* Track 'Start now' buttons with a specific GA4 type ([PR #3935](https://github.com/alphagov/govuk_publishing_components/pull/3935))
Expand Down
22 changes: 19 additions & 3 deletions spec/features/contextual_navigation_spec.rb
Expand Up @@ -22,13 +22,20 @@
and_i_see_the_other_step_by_step_as_an_also_part_of_list
end

scenario "There's a mainstream browse page tagged" do
given_theres_a_browse_page
scenario "The page is tagged to browse and has a browse parent" do
given_theres_a_page_tagged_to_browse_with_a_browse_parent
and_i_visit_that_page
then_i_see_the_browse_page_in_the_footer
and_the_default_breadcrumbs
end

scenario "The page is tagged to browse and does not have a browse parent" do
given_theres_a_page_tagged_to_browse_without_a_browse_parent
and_i_visit_that_page
then_i_see_the_browse_page_in_the_footer
then_i_see_the_topic_breadcrumb
end

scenario "Foreign travel advice content" do
given_theres_a_travel_advice_page
and_i_visit_that_page
Expand Down Expand Up @@ -254,7 +261,7 @@ def given_there_are_three_related_to_step_nav_and_one_secondary_to_step_nav
})
end

def given_theres_a_browse_page
def given_theres_a_page_tagged_to_browse_with_a_browse_parent
content_store_has_random_item(
links: {
"parent" => [top_level_mainstream_browse_page],
Expand All @@ -263,6 +270,15 @@ def given_theres_a_browse_page
)
end

def given_theres_a_page_tagged_to_browse_without_a_browse_parent
content_store_has_random_item(
links: {
"topics" => [topic_item],
"mainstream_browse_pages" => [example_item("mainstream_browse_page", "root_page")],
},
)
end

def given_theres_a_travel_advice_page
content_store_has_random_item(
schema: "travel_advice",
Expand Down