Update ServiceContactDetailsForm with new fields

Changes its:
- StringFields to GovukTextInputFields
- EmailFields to GovukEmailFields

Includes changes to templates that use this form
and associated tests.
This commit is contained in:
Tom Byers
2020-08-12 10:34:51 +01:00
parent 880a0a3318
commit 11dcd87115
3 changed files with 5 additions and 6 deletions
+3 -3
View File
@@ -1525,9 +1525,9 @@ class ServiceContactDetailsForm(StripWhitespaceForm):
],
)
url = StringField("URL")
email_address = EmailField("Email address")
phone_number = StringField("Phone number")
url = GovukTextInputField("URL")
email_address = GovukEmailField("Email address")
phone_number = GovukTextInputField("Phone number")
def validate(self):
@@ -1,5 +1,4 @@
{% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %}
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/radios.html" import radio %}
@@ -35,7 +34,7 @@
{{ radio(option, data_target=data_target) }}
<div class="panel panel-border-narrow js-hidden" id={{data_target}}>
{{ textbox(form|attr(option.data), label=' ', width='1-1') }}
{{ form|attr(option.data)(param_extensions={"classes": "govuk-!-width-full", "label": {"text": " "}}) }}
</div>
{% endfor %}
{% endcall %}
@@ -4186,7 +4186,7 @@ def test_send_files_by_email_contact_details_does_not_update_invalid_contact_det
_follow_redirects=True
)
assert normalize_spaces(page.find('span', class_='error-message').text) == error
assert error in page.find('span', class_='govuk-error-message').text
assert normalize_spaces(page.h1.text) == "Send files by email"