1
0
mirror of https://github.com/django/django.git synced 2025-10-29 08:36:09 +00:00

Refs #35706 -- Prefixed 'Error:' to titles of admin pages with form errors.

This improves the screen reader experience.
This commit is contained in:
sanjeevholla26
2024-08-30 23:44:32 +05:30
committed by Sarah Boyce
parent e4a2e22ddb
commit 387475c5b2
10 changed files with 63 additions and 0 deletions

View File

@@ -37,6 +37,12 @@ class AuthTemplateTests(TestCase):
)
self.assertContains(response, "<h1>Password reset</h1>")
def test_password_reset_view_error_title(self):
response = self.client.post(reverse("password_reset"), {})
self.assertContains(
response, "<title>Error: Password reset | Django site admin</title>"
)
def test_password_reset_done_view(self):
response = PasswordResetDoneView.as_view()(self.request)
self.assertContains(
@@ -77,6 +83,19 @@ class AuthTemplateTests(TestCase):
'<input class="hidden" autocomplete="username" value="jsmith">',
)
def test_password_reset_confirm_view_error_title(self):
client = PasswordResetConfirmClient()
default_token_generator = PasswordResetTokenGenerator()
token = default_token_generator.make_token(self.user)
uidb64 = urlsafe_base64_encode(str(self.user.pk).encode())
url = reverse(
"password_reset_confirm", kwargs={"uidb64": uidb64, "token": token}
)
response = client.post(url, {})
self.assertContains(
response, "<title>Error: Enter new password | Django site admin</title>"
)
@override_settings(AUTH_USER_MODEL="auth_tests.CustomUser")
def test_password_reset_confirm_view_custom_username_hint(self):
custom_user = CustomUser.custom_objects.create_user(