Remove review page from pa11y, move the building of modal header into the view, edit test (wip)

This commit is contained in:
Rachid Mrad 2023-12-15 02:36:04 -05:00
parent 8b6ca02de1
commit 6912b03cc0
No known key found for this signature in database
GPG key ID: EF38E4CEC4A8F3CF
4 changed files with 15 additions and 7 deletions

View file

@ -19,7 +19,6 @@
"http://localhost:8080/register/other_contacts/",
"http://localhost:8080/register/anything_else/",
"http://localhost:8080/register/requirements/",
"http://localhost:8080/register/review/",
"http://localhost:8080/register/finished/"
]
}

View file

@ -101,11 +101,11 @@
<div
class="usa-modal"
id="toggle-submit-domain-request"
aria-labelledby="Are you sure you want to continue?"
aria-describedby="Your DNSSEC records will be deleted from the registry."
aria-labelledby="Are you sure you want to submit a domain request?"
aria-describedby="Are you sure you want to submit a domain request?"
data-force-action
>
{% include 'includes/modal.html' with modal_heading="You are about to submit a domain request for yourcity.gov." modal_description="Once you submit this request, you wont be able to make further edits until its reviewed by our staff. Youll only be able to withdraw your request." modal_button=modal_button|safe %}
{% include 'includes/modal.html' with modal_heading=modal_heading|safe modal_description="Once you submit this request, you wont be able to make further edits until its reviewed by our staff. Youll only be able to withdraw your request." modal_button=modal_button|safe %}
</div>
{% block after_form_content %}{% endblock %}

View file

@ -1088,13 +1088,14 @@ class DomainApplicationTests(TestWithUser, WebTest):
def test_submit_modal(self):
"""When user clicks on submit your domain request, a modal pops up."""
completed_application()
# completed_application(name="cats.gov")
review_page = self.app.get(reverse("application:review"))
# We can't test the modal itself as it relies on JS for init and triggering,
# but we can test for the existence of its trigger:
self.assertContains(review_page, "toggle-submit-domain-request")
# And the existence of the modal's data parked and ready for the js init:
self.assertContains(review_page, "You are about to submit a domain request")
print(review_page)
self.assertContains(review_page, "You are about to submit")
class TestWithDomainPermissions(TestWithUser):

View file

@ -321,12 +321,19 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
def get_context_data(self):
"""Define context for access on all wizard pages."""
# Create HTML for the submit button:
# The on-page submit button is just a trigger for the modal;
# the submit button we're adding to context will get passed to
# the modal and is the button that triggers the actual domain
# application submission (via post -> goto_next_step -> done).
modal_button = '<button type="submit" ' 'class="usa-button" ' ">Submit request</button>"
# We'll concatenate the modal header here for passing along to the
# modal include. NOTE: We are able to 'fast-forward' a domain application
# by tyoing in review in the URL. The submit button still shows, hence
# the if/else.
if self.application.requested_domain:
modal_heading = 'You are about to submit a domain request for ' + str(self.application.requested_domain)
else:
modal_heading = 'You are about to submit an incomplete request'
return {
"form_titles": self.TITLES,
"steps": self.steps,
@ -334,6 +341,7 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
"visited": self.storage.get("step_history", []),
"is_federal": self.application.is_federal(),
"modal_button": modal_button,
"modal_heading": modal_heading,
}
def get_step_list(self) -> list: