From a698fb05299b7dd396ce95c17ffd6ea45cf3ffff Mon Sep 17 00:00:00 2001 From: Tijmen Brommet Date: Thu, 7 Jun 2018 08:45:41 +0100 Subject: [PATCH 1/2] Use government-navigation component from gem https://trello.com/c/uwcWXXNp --- app/views/layouts/application.html.erb | 2 +- test/integration/fatality_notice_test.rb | 2 +- test/integration/news_article_test.rb | 2 +- test/test_helper.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 654d0466a..58c00d1c3 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -29,7 +29,7 @@ <% unless content_for(:simple_header) %> - <%= render partial: 'govuk_component/government_navigation', locals: { active: active_proposition } %> + <%= render 'govuk_publishing_components/components/government_navigation', active: active_proposition %> <% end %>
diff --git a/test/integration/fatality_notice_test.rb b/test/integration/fatality_notice_test.rb index d7e4ff1db..10142d421 100644 --- a/test/integration/fatality_notice_test.rb +++ b/test/integration/fatality_notice_test.rb @@ -4,7 +4,7 @@ class FatalityNoticeTest < ActionDispatch::IntegrationTest test "typical fatality notice" do setup_and_visit_content_item('fatality_notice') - assert_has_component_government_navigation_active("announcements") + assert_has_component_government_navigation_active("Announcements") assert page.has_title?( "Sir George Pomeroy Colley killed in Boer War - Fatality notice - GOV.UK" diff --git a/test/integration/news_article_test.rb b/test/integration/news_article_test.rb index 1688b15f5..59cf4de7b 100644 --- a/test/integration/news_article_test.rb +++ b/test/integration/news_article_test.rb @@ -3,7 +3,7 @@ class NewsArticleTest < ActionDispatch::IntegrationTest test "news article renders title, description and body" do setup_and_visit_content_item("news_article") - assert_has_component_government_navigation_active("announcements") + assert_has_component_government_navigation_active("Announcements") assert_has_component_title(@content_item["title"]) assert page.has_text?(@content_item["description"]) assert page.has_text?("This year, the United Kingdom has had much to celebrate. Her Majesty The Queen celebrated her 90th birthday") diff --git a/test/test_helper.rb b/test/test_helper.rb index d45a6ec42..1b64be08e 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -90,7 +90,7 @@ def assert_has_component_organisation_logo(logo, index = 1) end def assert_has_component_government_navigation_active(active) - assert_component_parameter("government_navigation", "active", active) + assert page.has_css?("a", class: 'active', text: active) end def assert_has_contents_list(contents) From 7906a42ce43ac0fa0e00ae2ca8a7874b96196058 Mon Sep 17 00:00:00 2001 From: Tijmen Brommet Date: Thu, 7 Jun 2018 10:53:24 +0100 Subject: [PATCH 2/2] Remove duplicated test This is already tested by the tests for announcements. --- .../integration/government_navigation_test.rb | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 test/integration/government_navigation_test.rb diff --git a/test/integration/government_navigation_test.rb b/test/integration/government_navigation_test.rb deleted file mode 100644 index b0dbd13f3..000000000 --- a/test/integration/government_navigation_test.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'test_helper' - -class GovernmentNavigationTest < ActionDispatch::IntegrationTest - test "includes government navigation and sets the correct active item" do - example_body = get_content_example_by_schema_and_name("case_study", "case_study") - base_path = example_body.fetch("base_path") - content_store_has_item(base_path, example_body) - - visit base_path - - assert_has_active_government_navigation("case-studies") - end - - def assert_has_active_government_navigation(name) - within shared_component_selector("government_navigation") do - assert_equal name, JSON.parse(page.text).fetch("active") - end - end -end