Add hidden text for pills on job page

The links in the blue boxes on the job page needed hidden text so that
they work out of context. This changes the text from "10 sending" to "10
sending text messages" (with the message type hidden text).
This commit is contained in:
Katie Smith
2021-02-24 14:34:56 +00:00
parent 6512b8fad3
commit 82318387de
3 changed files with 17 additions and 8 deletions

View File

@@ -29,7 +29,7 @@ from app import (
notification_api_client,
service_api_client,
)
from app.formatters import get_time_left
from app.formatters import get_time_left, message_count_noun
from app.main import main
from app.main.forms import SearchNotificationsForm
from app.models.job import Job
@@ -336,6 +336,7 @@ def get_status_filters(service, message_type, statistics):
def _get_job_counts(job):
job_type = job.template_type
return [
(
label,
@@ -349,19 +350,27 @@ def _get_job_counts(job):
count
) for label, query_param, count in [
[
'total', '',
f'''total<span class="govuk-visually-hidden">
{message_count_noun(job.notification_count, job_type)}</span>''',
'',
job.notification_count
],
[
'sending', 'sending',
f'''sending<span class="govuk-visually-hidden">
{message_count_noun(job.notifications_sending, job_type)}</span>''',
'sending',
job.notifications_sending
],
[
'delivered', 'delivered',
f'''delivered<span class="govuk-visually-hidden">
{message_count_noun(job.notifications_delivered, job_type)}</span>''',
'delivered',
job.notifications_delivered
],
[
'failed', 'failed',
f'''failed<span class="govuk-visually-hidden">
{message_count_noun(job.notifications_failed, job_type)}</span>''',
'failed',
job.notifications_failed
]
]

View File

@@ -18,7 +18,7 @@
{% if show_count %}
{{ big_number(count, **big_number_args) }}
{% endif %}
<div class="pill-item__label{% if not show_count %} pill-item--centered{% endif %}">{{ label }}</div>
<div class="pill-item__label{% if not show_count %} pill-item--centered{% endif %}">{{ label | safe }}</div>
</a>
</li>
{% endfor %}

View File

@@ -190,7 +190,7 @@ def test_should_show_job_in_progress(
normalize_spaces(link.text)
for link in page.select('.pill a:not(.pill-item--selected)')
] == [
'10 sending', '0 delivered', '0 failed'
'10 sending text messages', '0 delivered text messages', '0 failed text messages'
]
assert page.select_one('p.hint').text.strip() == 'Report is 50% complete…'
@@ -215,7 +215,7 @@ def test_should_show_job_without_notifications(
normalize_spaces(link.text)
for link in page.select('.pill a:not(.pill-item--selected)')
] == [
'10 sending', '0 delivered', '0 failed'
'10 sending text messages', '0 delivered text messages', '0 failed text messages'
]
assert page.select_one('p.hint').text.strip() == 'Report is 50% complete…'
assert page.select_one('tbody').text.strip() == 'No messages to show yet…'