Skip to content

Commit

Permalink
Merge pull request #3944 from alphagov/update_breadcrumb_tests
Browse files Browse the repository at this point in the history
Update breadcrumb tests
  • Loading branch information
hannako committed Mar 22, 2024
2 parents e31f345 + 38b6ef1 commit 582bc56
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
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

0 comments on commit 582bc56

Please sign in to comment.