diff options
author | Durval Carvalho <durvalcsouza@outlook.com> | 2023-01-31 15:05:03 -0300 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-02-16 08:29:40 +0100 |
commit | 85366fbca723c9b37d0ac9db1d44e3f1cb188db2 (patch) | |
tree | 4c639dbd7d431b14d9dea655eb184f1cbd027f73 /tests/admin_changelist | |
parent | 6bdc3c58b65eb32fd63cd41849f00a17a36b4473 (diff) | |
download | django-85366fbca723c9b37d0ac9db1d44e3f1cb188db2.tar.gz |
Fixed #34045 -- Improved accessibility of selecting items in admin changelist.
This adds "aria-label".
Diffstat (limited to 'tests/admin_changelist')
-rw-r--r-- | tests/admin_changelist/tests.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/admin_changelist/tests.py b/tests/admin_changelist/tests.py index 413d6d4d7f..c603f15298 100644 --- a/tests/admin_changelist/tests.py +++ b/tests/admin_changelist/tests.py @@ -74,15 +74,15 @@ from .models import ( ) -def build_tbody_html(pk, href, extra_fields): +def build_tbody_html(obj, href, extra_fields): return ( "<tbody><tr>" '<td class="action-checkbox">' '<input type="checkbox" name="_selected_action" value="{}" ' - 'class="action-select"></td>' + 'class="action-select" aria-label="Select this object for an action - {}"></td>' '<th class="field-name"><a href="{}">name</a></th>' "{}</tr></tbody>" - ).format(pk, href, extra_fields) + ).format(obj.pk, str(obj), href, extra_fields) @override_settings(ROOT_URLCONF="admin_changelist.urls") @@ -245,7 +245,7 @@ class ChangeListTests(TestCase): table_output = template.render(context) link = reverse("admin:admin_changelist_child_change", args=(new_child.id,)) row_html = build_tbody_html( - new_child.id, link, '<td class="field-parent nowrap">-</td>' + new_child, link, '<td class="field-parent nowrap">-</td>' ) self.assertNotEqual( table_output.find(row_html), @@ -272,7 +272,7 @@ class ChangeListTests(TestCase): table_output = template.render(context) link = reverse("admin:admin_changelist_child_change", args=(new_child.id,)) row_html = build_tbody_html( - new_child.id, link, '<td class="field-parent nowrap">???</td>' + new_child, link, '<td class="field-parent nowrap">???</td>' ) self.assertNotEqual( table_output.find(row_html), @@ -297,7 +297,7 @@ class ChangeListTests(TestCase): table_output = template.render(context) link = reverse("admin:admin_changelist_child_change", args=(new_child.id,)) row_html = build_tbody_html( - new_child.id, + new_child, link, '<td class="field-age_display">&dagger;</td>' '<td class="field-age">-empty-</td>', @@ -327,13 +327,18 @@ class ChangeListTests(TestCase): table_output = template.render(context) link = reverse("admin:admin_changelist_child_change", args=(new_child.id,)) row_html = build_tbody_html( - new_child.id, link, '<td class="field-parent nowrap">%s</td>' % new_parent + new_child, link, '<td class="field-parent nowrap">%s</td>' % new_parent ) self.assertNotEqual( table_output.find(row_html), -1, "Failed to find expected row element: %s" % table_output, ) + self.assertInHTML( + '<input type="checkbox" id="action-toggle" ' + 'aria-label="Select all objects on this page for an action">', + table_output, + ) def test_result_list_editable_html(self): """ |