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

Use new breadcrumbs component in contextual breadcrumbs #313

Merged
merged 1 commit into from
May 15, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
navigation.step_nav_helper.header %>
<% elsif navigation.content_tagged_to_mainstream_browse_pages? %>
<!-- Rendering parent-based breadcrumbs because the page is tagged to mainstream browse -->
<%= render 'govuk_component/breadcrumbs', breadcrumbs: navigation.breadcrumbs %>
<%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: navigation.breadcrumbs %>
<% elsif navigation.content_has_curated_related_items? %>
<!-- Rendering parent-based breadcrumbs because the page has curated related links -->
<%= render 'govuk_component/breadcrumbs', breadcrumbs: navigation.breadcrumbs %>
<%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: navigation.breadcrumbs %>
<% elsif navigation.content_is_tagged_to_a_live_taxon? %>
<!-- Rendering taxonomy breadcrumbs because the page is tagged to live taxons -->
<%= render 'govuk_component/breadcrumbs',
<%= render 'govuk_publishing_components/components/breadcrumbs',
breadcrumbs: navigation.taxon_breadcrumbs[:breadcrumbs],
collapse_on_mobile: true %>
<% elsif navigation.breadcrumbs.any? %>
<!-- Rendering parent-based breadcrumbs because no browse, no related links, no live taxons -->
<%= render 'govuk_component/breadcrumbs', breadcrumbs: navigation.breadcrumbs %>
<%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: navigation.breadcrumbs %>
<% else %>
<!-- Not rendering any breadcrumbs because there aren't any -->
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</div>

<main id="wrapper" class="govuk-component-guide-wrapper">
<%= render 'govuk_component/breadcrumbs', breadcrumbs: @guide_breadcrumbs %>
<%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: @guide_breadcrumbs %>
<% else %>
<main id="wrapper">
<% end %>
Expand Down
1 change: 0 additions & 1 deletion spec/component_guide/component_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
visit '/component-guide'

expect(GovukPublishingComponents::ApplicationController).to include(Slimmer::GovukComponents)
expect(page).to have_selector(shared_component_selector('breadcrumbs'))
expect(page).to have_selector(shared_component_selector('title'))
end

Expand Down
1 change: 0 additions & 1 deletion spec/component_guide/static_component_guide_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
it 'loads shared components locally rather than through the network using Slimmer’s local component resolver' do
visit '/component-guide'

expect(page).to have_selector('.stubbed-breadcrumbs-component')
expect(page).to have_selector('.stubbed-title-component')
end
end
3 changes: 0 additions & 3 deletions spec/dummy/app/views/govuk_component/breadcrumbs.raw.html.erb

This file was deleted.

14 changes: 4 additions & 10 deletions spec/features/contextual_navigation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,13 @@ def then_i_see_the_related_links_sidebar
end

def and_the_parent_based_breadcrumbs
payload = within(shared_component_selector('breadcrumbs')) do
JSON.parse(page.text)
end

expect(payload.dig("breadcrumbs", 1, "title")).to eql("A parent")
expect(page).to have_selector(".gem-c-breadcrumbs")
expect(page).to have_content("Home A parent")
end

def and_the_taxonomy_breadcrumbs
payload = within(shared_component_selector('breadcrumbs')) do
JSON.parse(page.text)
end

expect(payload["breadcrumbs"].last["title"]).to eql("A live taxon")
expect(page).to have_selector(".gem-c-breadcrumbs")
expect(page).to have_content("Home A live taxon")
end

def then_i_see_the_taxonomy_sidebar_and_collection
Expand Down