Change generic connection error message, test for 13 nameservers on pageload

This commit is contained in:
Rachid Mrad 2023-10-30 18:52:23 -04:00
parent 3a1c64206f
commit 8b2ea986b1
No known key found for this signature in database
GPG key ID: EF38E4CEC4A8F3CF
5 changed files with 21 additions and 14 deletions

View file

@ -315,7 +315,6 @@ function prepareDeleteButtons(formLabel) {
if (isNameserversForm && forms.length < 3) {
// Hide the delete buttons on the remaining nameservers
Array.from(form.querySelectorAll('.delete-record')).forEach((deleteButton) => {
// deleteButton.classList.add("display-none");
deleteButton.setAttribute("disabled", "true");
});
}
@ -345,6 +344,11 @@ function prepareDeleteButtons(formLabel) {
formLabel = "DS Data record";
}
// On load: Disable the add more button if we have 13 forms
if (isNameserversForm && document.querySelectorAll(".repeatable-form").length == 13) {
addButton.setAttribute("disabled", "true");
}
// Attach click event listener on the delete buttons of the existing forms
prepareDeleteButtons(formLabel);
@ -361,7 +365,7 @@ function prepareDeleteButtons(formLabel) {
let formExampleRegex = RegExp(`ns(\\d){1}`, 'g');
// Some Nameserver form checks since the delete can mess up the source object we're copying
// in regards to required fileds and hidden delete buttons
// in regards to required fields and hidden delete buttons
if (isNameserversForm) {
// If the source element we're copying has required on an input,
@ -383,7 +387,6 @@ function prepareDeleteButtons(formLabel) {
// enable that button
let deleteButton= newForm.querySelector('.delete-record');
if (deleteButton.hasAttribute("disabled")) {
// newForm.querySelector('.delete-record').classList.remove("display-none");
deleteButton.removeAttribute("disabled");
}
}
@ -439,7 +442,6 @@ function prepareDeleteButtons(formLabel) {
// Disable the add more button if we have 13 forms
if (isNameserversForm && formNum == 13) {
// addButton.classList.add("display-none");
addButton.setAttribute("disabled", "true");
}
@ -447,7 +449,6 @@ function prepareDeleteButtons(formLabel) {
// Enable the delete buttons on the nameservers
forms.forEach((form, index) => {
Array.from(form.querySelectorAll('.delete-record')).forEach((deleteButton) => {
// deleteButton.classList.remove("display-none");
deleteButton.removeAttribute("disabled");
});
});

View file

@ -42,7 +42,7 @@ class DomainNameserverForm(forms.Form):
# add custom error messages
self.fields["server"].error_messages.update(
{
"required": "A minimum of 2 Name Servers are required.",
"required": "A minimum of 2 name servers are required.",
}
)

View file

@ -81,7 +81,7 @@
type="submit"
class="usa-button usa-button--outline"
name="btn-cancel-click"
aria-label="Reset the data in the Name Server form to the registry state (undo changes)"
aria-label="Reset the data in the name server form to the registry state (undo changes)"
>Cancel
</button>
</div>

View file

@ -1466,7 +1466,7 @@ class TestDomainNameservers(TestDomainOverview):
# the required field. form requires a minimum of 2 name servers
self.assertContains(
result,
"A minimum of 2 Name Servers are required.",
"A minimum of 2 name servers are required.",
count=2,
status_code=200,
)
@ -1639,7 +1639,7 @@ class TestDomainNameservers(TestDomainOverview):
# once around each required field.
self.assertContains(
result,
"A minimum of 2 Name Servers are required.",
"A minimum of 2 name servers are required.",
count=4,
status_code=200,
)
@ -1810,7 +1810,11 @@ class TestDomainSecurityEmail(TestDomainOverview):
(
"RegistryError",
form_data_registry_error,
"Update failed. Cannot contact the registry.",
"""
Were experiencing a system connection error. Please wait a few minutes
and try again. If you continue to receive this error after a few tries,
contact help@get.gov
""",
),
("ContactError", form_data_contact_error, "Value entered was wrong."),
(
@ -1845,7 +1849,7 @@ class TestDomainSecurityEmail(TestDomainOverview):
self.assertEqual(len(messages), 1)
message = messages[0]
self.assertEqual(message.tags, message_tag)
self.assertEqual(message.message, expected_message)
self.assertEqual(message.message.strip(), expected_message.strip())
def test_domain_overview_blocked_for_ineligible_user(self):
"""We could easily duplicate this test for all domain management

View file

@ -39,9 +39,11 @@ class GenericError(Exception):
"""
_error_mapping = {
GenericErrorCodes.CANNOT_CONTACT_REGISTRY: (
"Update failed. Cannot contact the registry."
),
GenericErrorCodes.CANNOT_CONTACT_REGISTRY: """
Were experiencing a system connection error. Please wait a few minutes
and try again. If you continue to receive this error after a few tries,
contact help@get.gov
""",
GenericErrorCodes.GENERIC_ERROR: ("Value entered was wrong."),
}