diff --git a/src/registrar/assets/js/get-gov.js b/src/registrar/assets/js/get-gov.js index 4cefd798b..e7260ee21 100644 --- a/src/registrar/assets/js/get-gov.js +++ b/src/registrar/assets/js/get-gov.js @@ -213,21 +213,17 @@ function HookupYesNoListener(radioButtonName, elementIdToShowIfYes, elementIdToS // Check if the element exists before accessing its value let selectedValue = radioButtonChecked ? radioButtonChecked.value : null; - if (elementIdToShowIfYes && elementIdToShowIfNo){ - switch (selectedValue) { - case 'True': - toggleTwoDomElements(elementIdToShowIfYes, elementIdToShowIfNo, 1); - break; + switch (selectedValue) { + case 'True': + toggleTwoDomElements(elementIdToShowIfYes, elementIdToShowIfNo, 1); + break; - case 'False': - toggleTwoDomElements(elementIdToShowIfYes, elementIdToShowIfNo, 2); - break; + case 'False': + toggleTwoDomElements(elementIdToShowIfYes, elementIdToShowIfNo, 2); + break; - default: - toggleTwoDomElements(elementIdToShowIfYes, elementIdToShowIfNo, 0); - } - }else { - console.log("No elements to show") + default: + toggleTwoDomElements(elementIdToShowIfYes, elementIdToShowIfNo, 0); } } diff --git a/src/registrar/models/domain_request.py b/src/registrar/models/domain_request.py index bfeb33c8e..02d07c9b2 100644 --- a/src/registrar/models/domain_request.py +++ b/src/registrar/models/domain_request.py @@ -1103,7 +1103,14 @@ class DomainRequest(TimeStampedModel): return self.other_contacts.exists() def has_additional_details(self) -> bool: - return self.has_anything_else_text() or self.has_cisa_representative + """Combines the has_anything_else_text and has_cisa_representative fields, + then returns if this domain request has either of them.""" + # Split out for linter + has_details = False + if self.has_anything_else_text or self.has_cisa_representative: + has_details = True + + return has_details def is_federal(self) -> Union[bool, None]: """Is this domain request for a federal agency? diff --git a/src/registrar/tests/test_views_request.py b/src/registrar/tests/test_views_request.py index 460900e28..19be5ce74 100644 --- a/src/registrar/tests/test_views_request.py +++ b/src/registrar/tests/test_views_request.py @@ -1037,8 +1037,9 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - # We expect to see this twice for both fields - self.assertContains(response, "This question is required.", count=2) + # We expect to see this twice for both fields. This results in a count of 4 + # due to screen reader information / html. + self.assertContains(response, "This question is required.", count=4) def test_submitting_other_contacts_deletes_no_other_contacts_rationale(self): """When a user submits the Other Contacts form with other contacts selected, the domain request's