Mr/text updates (#444)

* Updated error message text

* Updated field labels, intro text

* Tidy up thank you page

* Removed reference to managing a domain

* Update test language to match form language

* Fix linting error (hopefully)

* Fix linting and tests

---------

Co-authored-by: Neil Martinsen-Burrell <neil.martinsen-burrell@gsa.gov>
This commit is contained in:
Michelle Rago 2023-03-08 12:09:13 -05:00 committed by GitHub
parent 96c73471e4
commit 3cd3869c93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 14 deletions

View file

@ -226,8 +226,10 @@ class OrganizationElectionForm(RegistrarForm):
is_election_board = self.cleaned_data["is_election_board"] is_election_board = self.cleaned_data["is_election_board"]
if is_election_board is None: if is_election_board is None:
raise forms.ValidationError( raise forms.ValidationError(
"Select “Yes” if you represent an election office. Select “No” if you" (
" dont.", "Select “Yes” if you represent an election office. Select “No” if"
" you dont."
),
code="required", code="required",
) )
return is_election_board return is_election_board
@ -399,6 +401,12 @@ class CurrentSitesForm(RegistrarForm):
website = forms.URLField( website = forms.URLField(
required=False, required=False,
label="Public website", label="Public website",
error_messages={
"invalid": (
"Enter your organization's website in the required format, like"
" www.city.com."
)
},
) )
@ -676,7 +684,7 @@ class NoOtherContactsForm(RegistrarForm):
# label has to end in a space to get the label_suffix to show # label has to end in a space to get the label_suffix to show
label=( label=(
"Please explain why there are no other employees from your organization" "Please explain why there are no other employees from your organization"
" that we can contact." " we can contact to help us assess your eligibility for a .gov domain."
), ),
widget=forms.Textarea(), widget=forms.Textarea(),
) )
@ -692,7 +700,7 @@ class AnythingElseForm(RegistrarForm):
class RequirementsForm(RegistrarForm): class RequirementsForm(RegistrarForm):
is_policy_acknowledged = forms.BooleanField( is_policy_acknowledged = forms.BooleanField(
label=("I read and agree to the requirements for operating .gov domains."), label="I read and agree to the requirements for operating .gov domains.",
error_messages={ error_messages={
"required": ( "required": (
"Check the box if you read and agree to the requirements for" "Check the box if you read and agree to the requirements for"

View file

@ -1,7 +1,7 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% load static %} {% load static %}
{% block title %}Thank you for your domain request{% endblock %} {% block title %}Thanks for your domain request!{% endblock %}
{% block content %} {% block content %}
<main id="main-content" class="grid-container register-form-step"> <main id="main-content" class="grid-container register-form-step">
@ -14,7 +14,7 @@
/> />
<h1>Thank you</h1> <h1>Thank you</h1>
</span> </span>
<p> Thank you for your domain request. We'll email a copy of your request to you, <p>We'll email a copy of your request to you,
your authorizing official, and any contacts you added.</p> your authorizing official, and any contacts you added.</p>
<h2>Next steps in this process</h2> <h2>Next steps in this process</h2>

View file

@ -2,8 +2,7 @@
{% load field_helpers %} {% load field_helpers %}
{% block form_instructions %} {% block form_instructions %}
<p> Well use the following information to contact you about your domain request and, <p>Well use this information to contact you about your domain request.</p>
once your request is approved, about managing your domain.</p>
<p>If youd like us to use a different name, email, or phone number you can make those <p>If youd like us to use a different name, email, or phone number you can make those
changes below. Changing your contact information here wont affect your login.gov changes below. Changing your contact information here wont affect your login.gov
@ -35,4 +34,4 @@
{% endwith %} {% endwith %}
</fieldset> </fieldset>
{% endblock %} {% endblock %}

View file

@ -29,7 +29,13 @@ class TestFormValidation(TestCase):
def test_website_invalid(self): def test_website_invalid(self):
form = CurrentSitesForm(data={"website": "nah"}) form = CurrentSitesForm(data={"website": "nah"})
self.assertEqual(form.errors["website"], ["Enter a valid URL."]) self.assertEqual(
form.errors["website"],
[
"Enter your organization's"
" website in the required format, like www.city.com."
],
)
def test_website_valid(self): def test_website_valid(self):
form = CurrentSitesForm(data={"website": "hyphens-rule.gov.uk"}) form = CurrentSitesForm(data={"website": "hyphens-rule.gov.uk"})
@ -83,7 +89,7 @@ class TestFormValidation(TestCase):
"""Must be a valid phone number.""" """Must be a valid phone number."""
form = AuthorizingOfficialForm(data={"phone": "boss@boss"}) form = AuthorizingOfficialForm(data={"phone": "boss@boss"})
self.assertTrue( self.assertTrue(
form.errors["phone"][0].startswith("Enter a valid phone number") form.errors["phone"][0].startswith("Enter a valid phone number ")
) )
def test_your_contact_email_invalid(self): def test_your_contact_email_invalid(self):
@ -98,7 +104,7 @@ class TestFormValidation(TestCase):
"""Must be a valid phone number.""" """Must be a valid phone number."""
form = YourContactForm(data={"phone": "boss@boss"}) form = YourContactForm(data={"phone": "boss@boss"})
self.assertTrue( self.assertTrue(
form.errors["phone"][0].startswith("Enter a valid phone number") form.errors["phone"][0].startswith("Enter a valid phone number ")
) )
def test_other_contact_email_invalid(self): def test_other_contact_email_invalid(self):
@ -113,7 +119,7 @@ class TestFormValidation(TestCase):
"""Must be a valid phone number.""" """Must be a valid phone number."""
form = OtherContactsForm(data={"phone": "boss@boss"}) form = OtherContactsForm(data={"phone": "boss@boss"})
self.assertTrue( self.assertTrue(
form.errors["phone"][0].startswith("Enter a valid phone number") form.errors["phone"][0].startswith("Enter a valid phone number ")
) )
def test_requirements_form_blank(self): def test_requirements_form_blank(self):

View file

@ -445,7 +445,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
with less_console_noise(): with less_console_noise():
final_result = review_result.follow() final_result = review_result.follow()
self.assertContains(final_result, "Thank you for your domain request") self.assertContains(final_result, "Thanks for your domain request!")
# check that any new pages are added to this test # check that any new pages are added to this test
self.assertEqual(num_pages, num_pages_tested) self.assertEqual(num_pages, num_pages_tested)