Merge pull request #4236 from alphagov/fix-whitespace-copy

Remove whitespace from copy to clipboard component
This commit is contained in:
Chris Hill-Scott
2022-05-09 12:01:43 +01:00
committed by GitHub
2 changed files with 4 additions and 3 deletions
@@ -6,7 +6,7 @@
{% endif %} {% endif %}
<div data-module="copy-to-clipboard" data-value="{{ value }}" data-thing="{{ thing }}" data-name="{{ name }}"> <div data-module="copy-to-clipboard" data-value="{{ value }}" data-thing="{{ thing }}" data-name="{{ name }}">
<span class="copy-to-clipboard__value"> <span class="copy-to-clipboard__value">
{% if name|lower != thing|lower %}<span class="govuk-visually-hidden">{{ thing }}: </span>{% endif %}{{ value }} {%- if name|lower != thing|lower %}<span class="govuk-visually-hidden">{{ thing }}: </span>{% endif %}{{ value -}}
</span> </span>
<span class="copy-to-clipboard__notice" aria-live="assertive"></span> <span class="copy-to-clipboard__notice" aria-live="assertive"></span>
</div> </div>
+3 -2
View File
@@ -281,8 +281,9 @@ def test_should_create_api_key_with_type_normal(
_expected_status=200, _expected_status=200,
) )
assert page.select_one('span.copy-to-clipboard__value').text.strip() == ( assert page.select_one('span.copy-to-clipboard__value').text == (
'some_default_key_name_12-{}-{}'.format(SERVICE_ONE_ID, fake_uuid) # The text should be exactly this, with no leading or trailing whitespace
f'some_default_key_name_12-{SERVICE_ONE_ID}-{fake_uuid}'
) )
post.assert_called_once_with(url='/service/{}/api-key'.format(SERVICE_ONE_ID), data={ post.assert_called_once_with(url='/service/{}/api-key'.format(SERVICE_ONE_ID), data={