From 348e0138eb53026d4b395e8107978ef206d24d97 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Tue, 15 May 2018 13:19:53 +0100 Subject: [PATCH] Use new breadcrumbs component in contextual breadcrumbs The component is now available here rather than in static. --- .../components/_contextual_breadcrumbs.html.erb | 8 ++++---- .../application.html.erb | 2 +- spec/component_guide/component_index_spec.rb | 1 - .../component_guide/static_component_guide_spec.rb | 1 - .../views/govuk_component/breadcrumbs.raw.html.erb | 3 --- spec/features/contextual_navigation_spec.rb | 14 ++++---------- 6 files changed, 9 insertions(+), 20 deletions(-) delete mode 100644 spec/dummy/app/views/govuk_component/breadcrumbs.raw.html.erb diff --git a/app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb b/app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb index 92c209a015..ac22edfe5d 100644 --- a/app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb +++ b/app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb @@ -6,18 +6,18 @@ navigation.step_nav_helper.header %> <% elsif navigation.content_tagged_to_mainstream_browse_pages? %> - <%= render 'govuk_component/breadcrumbs', breadcrumbs: navigation.breadcrumbs %> + <%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: navigation.breadcrumbs %> <% elsif navigation.content_has_curated_related_items? %> - <%= 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? %> - <%= render 'govuk_component/breadcrumbs', + <%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: navigation.taxon_breadcrumbs[:breadcrumbs], collapse_on_mobile: true %> <% elsif navigation.breadcrumbs.any? %> - <%= render 'govuk_component/breadcrumbs', breadcrumbs: navigation.breadcrumbs %> + <%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: navigation.breadcrumbs %> <% else %> <% end %> diff --git a/app/views/layouts/govuk_publishing_components/application.html.erb b/app/views/layouts/govuk_publishing_components/application.html.erb index 00152e66b2..bcf52f329c 100644 --- a/app/views/layouts/govuk_publishing_components/application.html.erb +++ b/app/views/layouts/govuk_publishing_components/application.html.erb @@ -36,7 +36,7 @@
- <%= render 'govuk_component/breadcrumbs', breadcrumbs: @guide_breadcrumbs %> + <%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: @guide_breadcrumbs %> <% else %>
<% end %> diff --git a/spec/component_guide/component_index_spec.rb b/spec/component_guide/component_index_spec.rb index 1abd2be5a3..e82789278a 100644 --- a/spec/component_guide/component_index_spec.rb +++ b/spec/component_guide/component_index_spec.rb @@ -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 diff --git a/spec/component_guide/static_component_guide_spec.rb b/spec/component_guide/static_component_guide_spec.rb index 2d7d59bab6..59872517d1 100644 --- a/spec/component_guide/static_component_guide_spec.rb +++ b/spec/component_guide/static_component_guide_spec.rb @@ -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 diff --git a/spec/dummy/app/views/govuk_component/breadcrumbs.raw.html.erb b/spec/dummy/app/views/govuk_component/breadcrumbs.raw.html.erb deleted file mode 100644 index 075974980e..0000000000 --- a/spec/dummy/app/views/govuk_component/breadcrumbs.raw.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -
- Stubbed breadcrumb component normally lives in static -
diff --git a/spec/features/contextual_navigation_spec.rb b/spec/features/contextual_navigation_spec.rb index ae22a6575d..cbd8136255 100644 --- a/spec/features/contextual_navigation_spec.rb +++ b/spec/features/contextual_navigation_spec.rb @@ -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