-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1008 from alphagov/taxonomy-navigation-collections
Taxonomy navigation collections
- Loading branch information
Showing
7 changed files
with
140 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
<% | ||
content_item = @content_item.content_item.parsed_content | ||
|
||
if show_new_navigation? | ||
content_item['links'].yield_self { |links| links.except!('document_collections') } | ||
end | ||
%> | ||
|
||
<div class="column-one-third"> | ||
<%= render 'govuk_publishing_components/components/contextual_sidebar', content_item: @content_item.content_item.parsed_content %> | ||
<%= render 'govuk_publishing_components/components/contextual_sidebar', content_item: content_item %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
require 'test_helper' | ||
|
||
class ContentPagesRelatedNavigationTest < ActionDispatch::IntegrationTest | ||
include ContentPagesNavTestHelper | ||
include GdsApi::TestHelpers::Rummager | ||
|
||
test "ContentPagesNav variant A shows related collections in the sidebar" do | ||
setup_variant_a | ||
|
||
setup_and_visit_content_item('case_study') | ||
|
||
assert page.has_css?('.gem-c-related-navigation__sub-heading', text: 'Collection') | ||
end | ||
|
||
test "ContentPagesNav variant B shows related collections in the taxonomy navigation" do | ||
stub_rummager | ||
setup_variant_b | ||
|
||
setup_and_visit_content_item_with_taxons('case_study', SINGLE_TAXON) | ||
|
||
within '.taxonomy-navigation' do | ||
assert page.has_css?('.gem-c-heading', text: 'Collections') | ||
end | ||
end | ||
|
||
test "ContentPagesNav variant B does not show related collections in the sidebar" do | ||
setup_variant_b | ||
|
||
setup_and_visit_content_item('case_study') | ||
|
||
refute page.has_css?('.gem-c-related-navigation__sub-heading', text: 'Collection') | ||
end | ||
|
||
def setup_variant_a | ||
ContentItemsController.any_instance.stubs(:show_new_navigation?).returns(false) | ||
end | ||
|
||
def setup_variant_b | ||
ContentItemsController.any_instance.stubs(:show_new_navigation?).returns(true) | ||
end | ||
|
||
def schema_type | ||
"case_study" | ||
end | ||
end |