1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +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

@@ -1508,6 +1508,24 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
self.assertContains(response, "<h1>Change article</h1>")
self.assertContains(response, "<h2>Article 2</h2>")
def test_error_in_titles(self):
for url, subtitle in [
(
reverse("admin:admin_views_article_change", args=(self.a1.pk,)),
"Article 1 | Change article",
),
(reverse("admin:admin_views_article_add"), "Add article"),
(reverse("admin:login"), "Log in"),
(reverse("admin:password_change"), "Password change"),
(
reverse("admin:auth_user_password_change", args=(self.superuser.id,)),
"Change password: super",
),
]:
with self.subTest(url=url, subtitle=subtitle):
response = self.client.post(url, {})
self.assertContains(response, f"<title>Error: {subtitle}")
def test_view_subtitle_per_object(self):
viewuser = User.objects.create_user(
username="viewuser",