mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Add test coverage for configuration of autofocus
This commits adds test coverage for ther HTML in several of the forms which had broken autofocus. It means that if we make changes to the HTML which triggers autofocus in the future it should be more obvious that something is depending on the attributes being added/removed.
This commit is contained in:
@@ -164,6 +164,36 @@ def test_should_200_for_get_tour_step(
|
||||
)
|
||||
|
||||
|
||||
def test_should_show_empty_text_box(
|
||||
client_request,
|
||||
mock_get_service_template_with_multiple_placeholders,
|
||||
service_one,
|
||||
fake_uuid,
|
||||
):
|
||||
with client_request.session_transaction() as session:
|
||||
session['placeholders'] = {'phone number': '07700 900762'}
|
||||
|
||||
page = client_request.get(
|
||||
'main.tour_step',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
template_id=fake_uuid,
|
||||
step_index=1
|
||||
)
|
||||
|
||||
textbox = page.select_one('[data-module=autofocus][data-force-focus=True] .govuk-input')
|
||||
assert 'value' not in textbox
|
||||
assert textbox['name'] == 'placeholder_value'
|
||||
assert textbox['class'] == [
|
||||
'govuk-input', 'govuk-!-width-full',
|
||||
]
|
||||
# data-module=autofocus is set on a containing element so it
|
||||
# shouldn’t also be set on the textbox itself
|
||||
assert 'data-module' not in textbox
|
||||
assert normalize_spaces(
|
||||
page.select_one('label[for=placeholder_value]').text
|
||||
) == 'one'
|
||||
|
||||
|
||||
def test_should_prefill_answers_for_get_tour_step(
|
||||
client_request,
|
||||
mock_get_service_template_with_multiple_placeholders,
|
||||
|
||||
Reference in New Issue
Block a user