mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed #34834 -- Added role="search" to the admin changelist search form.
This commit is contained in:
parent
e2a3a896cf
commit
969ecb8236
@ -1,6 +1,6 @@
|
||||
{% load i18n static %}
|
||||
{% if cl.search_fields %}
|
||||
<div id="toolbar"><form id="changelist-search" method="get">
|
||||
<div id="toolbar"><form id="changelist-search" method="get" role="search">
|
||||
<div><!-- DIV needed for valid HTML -->
|
||||
<label for="searchbar"><img src="{% static "admin/img/search.svg" %}" alt="Search"></label>
|
||||
<input type="text" size="40" name="{{ search_var }}" value="{{ cl.query }}" id="searchbar"{% if cl.search_help_text %} aria-describedby="searchbar_helptext"{% endif %}>
|
||||
|
@ -1585,6 +1585,16 @@ class ChangeListTests(TestCase):
|
||||
'aria-describedby="searchbar_helptext">',
|
||||
)
|
||||
|
||||
def test_search_role(self):
|
||||
m = BandAdmin(Band, custom_site)
|
||||
m.search_fields = ["name"]
|
||||
request = self._mocked_authenticated_request("/band/", self.superuser)
|
||||
response = m.changelist_view(request)
|
||||
self.assertContains(
|
||||
response,
|
||||
'<form id="changelist-search" method="get" role="search">',
|
||||
)
|
||||
|
||||
def test_search_bar_total_link_preserves_options(self):
|
||||
self.client.force_login(self.superuser)
|
||||
url = reverse("admin:auth_user_changelist")
|
||||
|
Loading…
Reference in New Issue
Block a user