Merge branch 'master' into add_proxy_header_check

This commit is contained in:
Athanasios Voutsadakis
2017-11-20 17:41:12 +00:00
4 changed files with 32 additions and 21 deletions

View File

@@ -217,8 +217,8 @@ def set_sender(service_id, template_id):
def get_sender_context(sender_details, template_type): def get_sender_context(sender_details, template_type):
context = { context = {
'email': { 'email': {
'title': 'Send to one recipient', 'title': 'Where should replies come back to?',
'description': 'Where should replies go?', 'description': 'Where should replies come back to?',
'field_name': 'email_address' 'field_name': 'email_address'
}, },
'letter': { 'letter': {
@@ -227,7 +227,7 @@ def get_sender_context(sender_details, template_type):
'field_name': 'contact_block' 'field_name': 'contact_block'
}, },
'sms': { 'sms': {
'title': 'Send to one recipient', 'title': 'Who should the message come from?',
'description': 'Who should the message come from?', 'description': 'Who should the message come from?',
'field_name': 'sms_sender' 'field_name': 'sms_sender'
} }
@@ -421,7 +421,11 @@ def send_test_step(service_id, template_id, step_index):
skip_link = None skip_link = None
return render_template( return render_template(
'views/send-test.html', 'views/send-test.html',
page_title=get_send_test_page_title(template.template_type, get_help_argument()), page_title=get_send_test_page_title(
template.template_type,
get_help_argument(),
entering_recipient=not session['recipient']
),
template=template, template=template,
form=form, form=form,
skip_link=skip_link, skip_link=skip_link,
@@ -711,12 +715,14 @@ def all_placeholders_in_session(placeholders):
) )
def get_send_test_page_title(template_type, help_argument): def get_send_test_page_title(template_type, help_argument, entering_recipient):
if help_argument: if help_argument:
return 'Example text message' return 'Example text message'
if template_type == 'letter': if template_type == 'letter':
return 'Print a test letter' return 'Print a test letter'
return 'Send to one recipient' if entering_recipient:
return 'Who should this message be sent to?'
return 'Personalise this message'
def get_back_link(service_id, template_id, step_index): def get_back_link(service_id, template_id, step_index):

View File

@@ -2,12 +2,15 @@
field, field,
hint=None, hint=None,
disable=[], disable=[],
option_hints={} option_hints={},
hide_legend=False
) %} ) %}
<div class="form-group {% if field.errors %} form-group-error{% endif %}"> <div class="form-group {% if field.errors %} form-group-error{% endif %}">
<fieldset> <fieldset>
<legend class="form-label"> <legend class="form-label">
{{ field.label.text|safe }} {% if hide_legend %}<span class="visually-hidden">{% endif %}
{{ field.label.text|safe }}
{% if hide_legend %}</span>{% endif %}
{% if field.errors %} {% if field.errors %}
<span class="error-message" data-module="track-error" data-error-type="{{ field.errors[0] }}" data-error-label="{{ field.name }}"> <span class="error-message" data-module="track-error" data-error-type="{{ field.errors[0] }}" data-error-label="{{ field.name }}">
{{ field.errors[0] }} {{ field.errors[0] }}

View File

@@ -13,10 +13,10 @@
<div class="column-three-quarters"> <div class="column-three-quarters">
<form method="post"> <form method="post">
{{ radios( {{ radios(
form.sender, form.sender,
option_hints=option_hints option_hints=option_hints,
) hide_legend=True
}} ) }}
{{ page_footer( {{ page_footer(
'Continue', 'Continue',
back_link=url_for('.view_template', service_id=current_service.id, template_id=template_id), back_link=url_for('.view_template', service_id=current_service.id, template_id=template_id),

View File

@@ -44,14 +44,14 @@ test_non_spreadsheet_files = glob(path.join('tests', 'non_spreadsheet_files', '*
( (
mock_get_service_email_template, mock_get_service_email_template,
multiple_reply_to_email_addresses, multiple_reply_to_email_addresses,
'Send to one recipient', 'Where should replies come back to?',
'Where should replies go?', 'Where should replies come back to?',
), ),
( (
mock_get_service_template, mock_get_service_template,
multiple_sms_senders, multiple_sms_senders,
'Send to one recipient', 'Who should the message come from?',
'Who should the message come from?' 'Who should the message come from?',
) )
]) ])
def test_show_correct_title_and_description_for_sender_type( def test_show_correct_title_and_description_for_sender_type(
@@ -74,7 +74,9 @@ def test_show_correct_title_and_description_for_sender_type(
) )
assert page.select_one('h1').text == expected_title assert page.select_one('h1').text == expected_title
assert normalize_spaces(page.select_one('legend').text) == expected_description
for element in ('legend', 'legend .visually-hidden'):
assert normalize_spaces(page.select_one(element).text) == expected_description
@pytest.mark.parametrize('template_mock, sender_data', [ @pytest.mark.parametrize('template_mock, sender_data', [
@@ -573,13 +575,13 @@ def test_send_one_off_does_not_send_without_the_correct_permissions(
( (
mock_get_service_template_with_placeholders, mock_get_service_template_with_placeholders,
partial(url_for, 'main.send_test'), partial(url_for, 'main.send_test'),
'Send to one recipient', 'Personalise this message',
False, False,
), ),
( (
mock_get_service_template_with_placeholders, mock_get_service_template_with_placeholders,
partial(url_for, 'main.send_one_off'), partial(url_for, 'main.send_one_off'),
'Send to one recipient', 'Who should this message be sent to?',
False, False,
), ),
( (
@@ -597,13 +599,13 @@ def test_send_one_off_does_not_send_without_the_correct_permissions(
( (
mock_get_service_email_template, mock_get_service_email_template,
partial(url_for, 'main.send_test'), partial(url_for, 'main.send_test'),
'Send to one recipient', 'Personalise this message',
False, False,
), ),
( (
mock_get_service_email_template, mock_get_service_email_template,
partial(url_for, 'main.send_one_off'), partial(url_for, 'main.send_one_off'),
'Send to one recipient', 'Who should this message be sent to?',
False, False,
), ),
( (