summaryrefslogtreecommitdiff
path: root/tests/admin_views/tests.py
diff options
context:
space:
mode:
authorsanjeevholla26 <sanjeevholla26@gmail.com>2024-08-30 23:44:32 +0530
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-09-02 15:19:33 +0200
commit387475c5b2f1aa32103dbe21cb281d3b35165a0c (patch)
treec239d02a75de21531ef368e08e68ae05f68ac75a /tests/admin_views/tests.py
parente4a2e22ddbf1b892144b35dc21404c164bc848c6 (diff)
Refs #35706 -- Prefixed 'Error:' to titles of admin pages with form errors.
This improves the screen reader experience.
Diffstat (limited to 'tests/admin_views/tests.py')
-rw-r--r--tests/admin_views/tests.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index 9a031a1e51..fc1bb86d85 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -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",