From 2291c4faf476aa7ea74185fa67fc580a03a84006 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Tue, 25 Jul 2017 22:57:01 +0100 Subject: [PATCH] Make sure errors on one-off flow have red border MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When I split up the error messages on the check CSV page into multiple templates, I also reduced the repetition of wrapping `
`s and macro calls by moving them up outside the conditional blocks (see 8e947f315d9b864f79ffd8771b36cd0061eacc3d). Unfortunately I didn’t make the same adjustments for the one-off flow, which meant that errors on these pages lost their styling. This commit re-adds the styling for these error messages. --- app/templates/views/notifications/check.html | 30 ++++++++++++++------ tests/app/main/views/test_send.py | 4 +-- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/app/templates/views/notifications/check.html b/app/templates/views/notifications/check.html index e9f65c00d..66a840659 100644 --- a/app/templates/views/notifications/check.html +++ b/app/templates/views/notifications/check.html @@ -1,5 +1,5 @@ {% extends "withnav_template.html" %} -{% from "components/radios.html" import radio_select %} +{% from "components/banner.html" import banner_wrapper %} {% from "components/message-count-label.html" import message_count_label %} {% block service_page_title %} @@ -8,17 +8,29 @@ {% block maincolumn_content %} {% if error == 'not-allowed-to-send-to' %} - {% with - count_of_recipients=1, - template_type_label='phone number' - %} - {% include "partials/check/not-allowed-to-send-to.html" %} - {% endwith %} +
+ {% call banner_wrapper(type='dangerous') %} + {% with + count_of_recipients=1, + template_type_label='phone number' + %} + {% include "partials/check/not-allowed-to-send-to.html" %} + {% endwith %} + {% endcall %} +
{% elif error == 'too-many-messages' %} - {% include "partials/check/too-many-messages.html" %} +
+ {% call banner_wrapper(type='dangerous') %} + {% include "partials/check/too-many-messages.html" %} + {% endcall %} +
{% elif error == 'message-too-long' %} {# the only row_errors we can get when sending one off messages is that the message is too long #} - {% include "partials/check/message-too-long.html" %} +
+ {% call banner_wrapper(type='dangerous') %} + {% include "partials/check/message-too-long.html" %} + {% endcall %} +
{% else %}

Preview of {{ template.name }} diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index 39d0e05a0..8a9499ee5 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -1937,6 +1937,6 @@ def test_send_notification_shows_error_if_400( _expected_status=200 ) - assert ' '.join(page.h1.text.split()) == expected_h1 - assert ' '.join(page.h1.parent.p.text.split()) == expected_err_details + assert normalize_spaces(page.select('.banner-dangerous h1')[0].text) == expected_h1 + assert normalize_spaces(page.select('.banner-dangerous p')[0].text) == expected_err_details assert not page.find('input[type=submit]')