Skip to content

Commit

Permalink
Update brexit notice
Browse files Browse the repository at this point in the history
  • Loading branch information
sihugh committed Aug 11, 2020
1 parent 522aff8 commit 6262db8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
5 changes: 3 additions & 2 deletions app/presenters/content_item/no_deal_notice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ def no_deal_notice_links
end

def no_deal_notice_title
"The UK has left the EU and the transition period after Brexit comes to an end this year."
"New rules for January 2021"
end

def no_deal_notice_description
"This page tells you what you'll need to do from 1 January 2021. It will be updated if anything changes."
["The UK has left the EU, and the transition period after Brexit comes to an end this year.",
"This page tells you what you'll need to do from 1 January 2021. It will be updated if anything changes."]
end

def no_deal_notice_link_intro
Expand Down
8 changes: 7 additions & 1 deletion app/views/components/_header-notice.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
</div>

<div class="app-c-header-notice__content">
<p class="app-c-header-notice__text govuk-body"><%= description %></p>
<% if description.is_a? Array %>
<% description.map do |line| %>
<p class="app-c-header-notice__text govuk-body"><%= line %></p>
<% end %>
<% else %>
<p class="app-c-header-notice__text govuk-body"><%= description %></p>
<% end %>
<% if links.any? %>
<div class="app-c-header-notice__links">
<% if links.count == 1 %>
Expand Down
8 changes: 8 additions & 0 deletions test/components/header_notice_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ def component_name
assert_select ".app-c-header-notice__content p", text: "This is some important information about the content."
end

test "renders a header notice with text correctly with a multi-line description" do
render_component(title: "This is an important notice", description: ["This is some important information about the content.", "It runs on to two lines."])

assert_select ".app-c-header-notice__title", text: "This is an important notice"
assert_select ".app-c-header-notice__content p", text: "This is some important information about the content."
assert_select ".app-c-header-notice__content p", text: "It runs on to two lines."
end

test "renders a header notice with an aria label" do
render_component(title: "This is an important notice", description: "This is some important information about the content.")
assert_select "section[aria-label=notice]"
Expand Down

0 comments on commit 6262db8

Please sign in to comment.