Skip to content

Commit

Permalink
Merge pull request #3522 from alphagov/parent-breadcrumb
Browse files Browse the repository at this point in the history
All content finder: Enable parent breadcrumb
  • Loading branch information
csutter authored Oct 21, 2024
2 parents 15b09d0 + 2319a74 commit b0b436f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/views/finders/show_all_content_finder.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@
<% end %>
<% content_for :meta_title, content_item.title %>
<%= render 'govuk_publishing_components/components/contextual_breadcrumbs', content_item: content_item.as_hash %>
<% if @breadcrumbs.breadcrumbs %>
<%= render 'govuk_publishing_components/components/breadcrumbs', {
breadcrumbs: @breadcrumbs.breadcrumbs,
collapse_on_mobile: true,
} %>
<% else %>
<%= render 'govuk_publishing_components/components/contextual_breadcrumbs', {
content_item: content_item.as_hash,
} %>
<% end %>
<%= tag.div(
class: "app-all-content-finder",
Expand Down
12 changes: 12 additions & 0 deletions features/all_content_finder.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Feature: All content finder ("site search")
Then I can see results for my search
And I can see how many results there are
And the GA4 ecommerce tracking tags are present
And I can see a breadcrumb for home
And no breadcrumb for all organisations
Scenario: Making a search with a hidden clearable filter
When I search for "search-term" with a hidden clearable manual filter
Expand Down Expand Up @@ -73,3 +75,13 @@ Feature: All content finder ("site search")
Scenario: Spelling suggestion
When I search all content for "drving"
Then I see a "driving" spelling suggestion
Scenario: Search with an organisation (parent) finder
When I search all content with a parent for "search-term"
And I open the filter panel
And I open the "Sort by" filter section
And I select the "Updated (newest)" option
And I apply the filters
Then I can see a breadcrumb for home
And I can see a breadcrumb for all organisations
And I can see a breadcrumb for the organisation
4 changes: 4 additions & 0 deletions features/step_definitions/site_search_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
visit "/search/all?q=#{search_term}"
end

When(/^I search all content with a parent for "([^"]*)"$/) do |search_term|
visit "/search/all?parent=ministry-of-magic&organisations[]=ministry-of-magic&q=#{search_term}"
end

When(/^I search for "([^"]*)" with a hidden clearable manual filter$/) do |search_term|
visit "/search/all?q=#{search_term}&manual%5B%5D=how-to-be-a-wizard"
end
Expand Down

0 comments on commit b0b436f

Please sign in to comment.