1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +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

@@ -1264,6 +1264,24 @@ class ChangeListTests(TestCase):
# Check only the first few characters since the UUID may have dashes.
self.assertIn(str(a.pk)[:8], context.captured_queries[4]["sql"])
def test_list_editable_error_title(self):
a = Swallow.objects.create(origin="Swallow A", load=4, speed=1)
Swallow.objects.create(origin="Swallow B", load=2, speed=2)
data = {
"form-TOTAL_FORMS": "2",
"form-INITIAL_FORMS": "2",
"form-MIN_NUM_FORMS": "0",
"form-MAX_NUM_FORMS": "1000",
"form-0-uuid": str(a.pk),
"form-0-load": "invalid",
"_save": "Save",
}
superuser = self._create_superuser("superuser")
self.client.force_login(superuser)
changelist_url = reverse("admin:admin_changelist_swallow_changelist")
response = self.client.post(changelist_url, data=data)
self.assertContains(response, "Error: Select swallow to change")
def test_deterministic_order_for_unordered_model(self):
"""
The primary key is used in the ordering of the changelist's results to