Skip to content

Commit

Permalink
Use title component from gem
Browse files Browse the repository at this point in the history
  • Loading branch information
tijmenb committed Jun 7, 2018
1 parent 717e9ea commit d1d62e8
Show file tree
Hide file tree
Showing 34 changed files with 36 additions and 43 deletions.
2 changes: 1 addition & 1 deletion app/views/content_items/_body_with_related_links.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title',
<%= render 'govuk_publishing_components/components/title',
title: @content_item.title %>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/case_study.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="grid-row">
<div class="column-two-thirds responsive-top-margin">
<%= render 'govuk_component/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
</div>
<%= render 'shared/translations' %>
<div class="column-two-thirds">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/coming_soon.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', title: 'Coming soon' %>
<%= render 'govuk_publishing_components/components/title', title: 'Coming soon' %>

<p class="summary">
This document will be published on<br />
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/consultation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
</div>
<%= render 'shared/translations' %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/contact.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</div>
<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', title: @content_item.title %>
<%= render 'govuk_publishing_components/components/title', title: @content_item.title %>
</div>
<%= render 'shared/translations' %>
<div class="column-two-thirds">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/detailed_guide.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
</div>
<%= render 'shared/translations' %>
<div class="column-two-thirds">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/document_collection.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title',
<%= render 'govuk_publishing_components/components/title',
context: t("content_item.schema_name.#{@content_item.document_type}", count: 1),
title: @content_item.title,
average_title_length: "long" %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/fatality_notice.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
</div>
<%= render 'shared/translations' %>
<div class="column-two-thirds">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/gone.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', title: 'The page you\'re looking for is no longer available' %>
<%= render 'govuk_publishing_components/components/title', title: 'The page you\'re looking for is no longer available' %>

<p class="summary">
The information on this page has been removed because it was published in error.
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/guide.html+print.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<div class="grid-row guide-print">
<div class="column-two-thirds">
<%= render 'govuk_component/title', { title: @content_item.title } %>
<%= render 'govuk_publishing_components/components/title', { title: @content_item.title } %>
<% @content_item.parts.each_with_index do |part, index| %>
<section>
<h1 class="part-title">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/guide.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', { title: @content_item.title } %>
<%= render 'govuk_publishing_components/components/title', { title: @content_item.title } %>
<% if @content_item.multi_page_guide? %>
<aside class="part-navigation-container" role="complementary">
<%= render "govuk_publishing_components/components/contents_list", aria_label: 'Pages in this guide', contents: @content_item.part_link_elements, underline_links: true %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/html_publication.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</div>

<%= render 'govuk_publishing_components/components/inverse_header', {} do %>
<%= render 'govuk_component/title',
<%= render 'govuk_publishing_components/components/title',
title: @content_item.title,
context: I18n.t("content_item.schema_name.#{@content_item.format_sub_type}", count: 1),
inverse: true,
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/news_article.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
</div>
<%= render 'shared/translations' %>
<div class="column-two-thirds">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/publication.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title',
<%= render 'govuk_publishing_components/components/title',
context: t("content_item.schema_name.#{@content_item.document_type}", count: 1),
title: @content_item.title,
average_title_length: "long" %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<% end %>

<%= form_tag({controller: 'content_items', action: 'service_sign_in_options'}, method: "post", data: { module: 'track-radio-group' }) do %>
<% legend_text = render 'govuk_component/title', title: @content_item.title %>
<% legend_text = render 'govuk_publishing_components/components/title', title: @content_item.title %>
<%= render "govuk_publishing_components/components/fieldset", legend_text: legend_text do %>
<div class="grid-row">
<div class="column-two-thirds">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', title: @content_item.title %>
<%= render 'govuk_publishing_components/components/title', title: @content_item.title %>
<%= render 'govuk_publishing_components/components/govspeak', content: @content_item.body %>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/content_items/specialist_document.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<div class="grid-row">
<div class="column-two-thirds responsive-top-margin">
<%= render 'govuk_component/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
</div>
<%= render 'shared/translations' %>
<div class="column-two-thirds">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/speech.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
</div>
<%= render 'shared/translations' %>
<div class="column-two-thirds">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/statistical_data_set.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title',
<%= render 'govuk_publishing_components/components/title',
context: t("content_item.schema_name.#{@content_item.document_type}", count: 1),
title: @content_item.title,
average_title_length: "long" %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/statistics_announcement.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/lead_paragraph', text: @content_item.description %>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/take_part.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/lead_paragraph', text: @content_item.description %>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/travel_advice.html+print.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<div class="grid-row travel-advice-print">
<div class="column-two-thirds">
<%= render 'govuk_component/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
<% @content_item.parts.each_with_index do |part, i| %>
<section>
<h1 class="part-title">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/travel_advice.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
<aside class="part-navigation-container" role="complementary">

<nav role="navigation" class="grid-row part-navigation" aria-label="Travel advice pages" data-module="track-click">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/unpublishing.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', title: 'The page you\'re looking for is no longer available' %>
<%= render 'govuk_publishing_components/components/title', title: 'The page you\'re looking for is no longer available' %>

<p class="summary">
The information on this page has been removed because it was published in error.
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/working_group.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<div class="grid-row">
<div class="column-two-thirds responsive-top-margin">
<%= render 'govuk_component/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
</div>
<%= render 'shared/translations' %>
<div class="column-two-thirds">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
</div>
<%= render 'shared/translations' %>
<div class="column-two-thirds">
Expand Down
2 changes: 1 addition & 1 deletion app/views/development/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<body>
<div id="wrapper">
<main class="govspeak">
<%= render 'govuk_component/title', title: 'government-frontend' %>
<%= render 'govuk_publishing_components/components/title', title: 'government-frontend' %>

<% html = capture do %>
<p>
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_title_and_translations.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="grid-row">
<div class="column-two-thirds">
<%= render 'govuk_component/title', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
</div>
<%= render 'shared/translations' %>
</div>
2 changes: 1 addition & 1 deletion test/integration/fatality_notice_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class FatalityNoticeTest < ActionDispatch::IntegrationTest
visible: false
)

assert_component_parameter("title", "context", "Operations in Zululand")
assert page.has_content?("Operations in Zululand")
assert_has_component_title("Sir George Pomeroy Colley killed in Boer War")

refute page.has_css?(".gem-c-notice")
Expand Down
8 changes: 2 additions & 6 deletions test/integration/service_sign_in/choose_sign_in_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ class ChooseSignInTest < ActionDispatch::IntegrationTest
within "#content form" do
within ".gem-c-fieldset" do
within ".gem-c-fieldset__legend" do
within shared_component_selector('title') do
assert page.has_text?("Prove your identity to continue")
end
assert_has_component_title "Prove your identity to continue"
end

within ".gem-c-govspeak" do
Expand Down Expand Up @@ -85,9 +83,7 @@ class ChooseSignInTest < ActionDispatch::IntegrationTest
within "#content form" do
within ".gem-c-fieldset" do
within ".gem-c-fieldset__legend" do
within shared_component_selector('title') do
assert page.has_text?("Profwch pwy ydych chi i fwrw ymlaen")
end
assert_has_component_title "Profwch pwy ydych chi i fwrw ymlaen"
end

within ".gem-c-govspeak" do
Expand Down
5 changes: 2 additions & 3 deletions test/integration/service_sign_in/create_new_account_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ class CreateNewAccount < ActionDispatch::IntegrationTest
setup_and_visit_create_new_account_page

assert page.has_css?("title", text: 'Create an account - GOV.UK', visible: false)
within shared_component_selector('title') do
assert page.has_text?("Create an account")
end

assert_has_component_title "Create an account"

assert page.has_text?("To use this service, you need to create either a Government Gateway or GOV.UK Verify account. These are used to help fight identity theft.")
assert page.has_css?('meta[name="robots"][content="noindex, nofollow"]', visible: false)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/specialist_document_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SpecialistDocumentTest < ActionDispatch::IntegrationTest
test "renders title, description and body" do
setup_and_visit_content_item('aaib-reports')

assert_has_component_title(@content_item["title"])
assert_has_component_title(@content_item["title"].strip)
assert page.has_text?(@content_item["description"])
assert page.has_text?("The gyroplane began to move forward against the brakes before sufficient rotor rpm had been achieved for takeoff.")
end
Expand Down
4 changes: 1 addition & 3 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ def assert_component_parameter(component, label, value)
end

def assert_has_component_title(title)
within shared_component_selector("title") do
assert_equal title, JSON.parse(page.text).fetch("title")
end
assert page.has_css?('h1', text: title)
end

def assert_has_component_organisation_logo(logo, index = 1)
Expand Down

0 comments on commit d1d62e8

Please sign in to comment.