Add H1 to sent messages page

> Suggest making the H1 visible here for consistency, but also to make
> it clear to users what they’re looking at.

> This screen is similar to – but not exactly the same as – the
> individual text, email and letter dashboard screens from Admin view,
> so the H1 could help to distinguish it from them for users who may
> have interacted with both.
This commit is contained in:
Chris Hill-Scott
2018-07-13 17:02:27 +01:00
parent ca9fe6c8f6
commit b946a6008d
2 changed files with 39 additions and 36 deletions
+8 -4
View File
@@ -4,16 +4,20 @@
{% from "components/page-footer.html" import page_footer %} {% from "components/page-footer.html" import page_footer %}
{% from "components/textbox.html" import textbox %} {% from "components/textbox.html" import textbox %}
{% set page_title = (
message_count_label(99, message_type, suffix='') | capitalize
if current_user.has_permissions('view_activity')
else 'Sent messages'
) %}
{% block service_page_title %} {% block service_page_title %}
{{ message_count_label(99, message_type, suffix='') | capitalize }} {{ page_title }}
{% endblock %} {% endblock %}
{% block maincolumn_content %} {% block maincolumn_content %}
<h1 class="heading-large"> <h1 class="heading-large">
{% if not current_user.has_permissions('view_activity') %}<span class="visually-hidden">{% endif %} {{ page_title }}
{{ message_count_label(99, message_type, suffix='') | capitalize }}
{% if not current_user.has_permissions('view_activity') %}</span>{% endif %}
</h1> </h1>
{% if not message_type == "letter" %} {% if not message_type == "letter" %}
+31 -32
View File
@@ -19,14 +19,11 @@ from tests.conftest import (
) )
@pytest.mark.parametrize('user', (
active_user_view_permissions,
active_caseworking_user,
))
@pytest.mark.parametrize( @pytest.mark.parametrize(
"message_type,page_title", [ "user,extra_args,expected_update_endpoint,page_title", [
('email', 'Emails'), (active_user_view_permissions, {'message_type': 'email'}, '/email.json', 'Emails'),
('sms', 'Text messages') (active_user_view_permissions, {'message_type': 'sms'}, '/sms.json', 'Text messages'),
(active_caseworking_user, {}, '.json', 'Sent messages'),
] ]
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
@@ -68,11 +65,14 @@ from tests.conftest import (
] ]
) )
def test_can_show_notifications( def test_can_show_notifications(
client_request,
logged_in_client, logged_in_client,
service_one, service_one,
mock_get_notifications, mock_get_notifications,
mock_get_service_statistics, mock_get_service_statistics,
message_type, user,
extra_args,
expected_update_endpoint,
page_title, page_title,
status_argument, status_argument,
expected_api_call, expected_api_call,
@@ -81,33 +81,29 @@ def test_can_show_notifications(
to_argument, to_argument,
expected_to_argument, expected_to_argument,
mocker, mocker,
user,
fake_uuid, fake_uuid,
): ):
mocker.patch('app.user_api_client.get_user', return_value=user(fake_uuid)) client_request.login(user(fake_uuid))
if expected_to_argument: if expected_to_argument:
response = logged_in_client.post( page = client_request.post(
url_for(
'main.view_notifications',
service_id=service_one['id'],
message_type=message_type,
status=status_argument,
page=page_argument,
),
data={
'to': to_argument
}
)
else:
response = logged_in_client.get(url_for(
'main.view_notifications', 'main.view_notifications',
service_id=service_one['id'], service_id=service_one['id'],
message_type=message_type,
status=status_argument, status=status_argument,
page=page_argument, page=page_argument,
)) _data={
assert response.status_code == 200 'to': to_argument
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') },
_expected_status=200,
**extra_args
)
else:
page = client_request.get(
'main.view_notifications',
service_id=service_one['id'],
status=status_argument,
page=page_argument,
**extra_args
)
text_of_first_row = page.select('tbody tr')[0].text text_of_first_row = page.select('tbody tr')[0].text
assert '07123456789' in text_of_first_row assert '07123456789' in text_of_first_row
assert ( assert (
@@ -120,7 +116,10 @@ def test_can_show_notifications(
path_to_json = page.find("div", {'data-key': 'notifications'})['data-resource'] path_to_json = page.find("div", {'data-key': 'notifications'})['data-resource']
url = urlparse(path_to_json) url = urlparse(path_to_json)
assert url.path == '/services/{}/notifications/{}.json'.format(service_one['id'], message_type) assert url.path == '/services/{}/notifications{}'.format(
service_one['id'],
expected_update_endpoint,
)
query_dict = parse_qs(url.query) query_dict = parse_qs(url.query)
if status_argument: if status_argument:
assert query_dict['status'] == [status_argument] assert query_dict['status'] == [status_argument]
@@ -133,15 +132,15 @@ def test_can_show_notifications(
page=expected_page_argument, page=expected_page_argument,
service_id=service_one['id'], service_id=service_one['id'],
status=expected_api_call, status=expected_api_call,
template_type=[message_type], template_type=list(extra_args.values()),
to=expected_to_argument, to=expected_to_argument,
) )
json_response = logged_in_client.get(url_for( json_response = logged_in_client.get(url_for(
'main.get_notifications_as_json', 'main.get_notifications_as_json',
service_id=service_one['id'], service_id=service_one['id'],
message_type=message_type, status=status_argument,
status=status_argument **extra_args
)) ))
json_content = json.loads(json_response.get_data(as_text=True)) json_content = json.loads(json_response.get_data(as_text=True))
assert json_content.keys() == {'counts', 'notifications'} assert json_content.keys() == {'counts', 'notifications'}