diff options
| author | Marijke Luttekes <mail@marijkeluttekes.dev> | 2024-05-20 14:39:09 -0300 |
|---|---|---|
| committer | nessita <124304+nessita@users.noreply.github.com> | 2024-05-22 00:13:55 -0300 |
| commit | e4a693f50a8342ed1a54b74e1a202b44c8e62981 (patch) | |
| tree | fe5924414b2edafaec2ee4c7709cbf86dfc94220 /tests/admin_views/tests.py | |
| parent | 01ed59f753139afb514170ee7f7384c155ecbc2d (diff) | |
Fixed #35189 -- Improved admin collapsible fieldsets by using <details> elements.
This work improves the accessibility of the add and change pages in the
admin site by adding <details> and <summary> elements to the collapsible
fieldsets. This has the nice side effect of no longer requiring custom
JavaScript helpers to implement the fieldsets' show/hide capabilities.
Thanks to James Scholes for the accessibility advice, and to Sarah Boyce
and Tom Carrick for reviews.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
Diffstat (limited to 'tests/admin_views/tests.py')
| -rw-r--r-- | tests/admin_views/tests.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 5fab253f80..d49e7d028b 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -1939,7 +1939,6 @@ class AdminJavaScriptTest(TestCase): self.assertContains(response, "vendor/jquery/jquery.min.js") self.assertContains(response, "prepopulate.js") self.assertContains(response, "actions.js") - self.assertContains(response, "collapse.js") self.assertContains(response, "inlines.js") with override_settings(DEBUG=True): response = self.client.get(reverse("admin:admin_views_section_add")) @@ -1947,7 +1946,6 @@ class AdminJavaScriptTest(TestCase): self.assertNotContains(response, "vendor/jquery/jquery.min.js") self.assertContains(response, "prepopulate.js") self.assertContains(response, "actions.js") - self.assertContains(response, "collapse.js") self.assertContains(response, "inlines.js") @@ -6086,11 +6084,8 @@ class SeleniumTests(AdminSeleniumTestCase): ) self.assertFalse(self.selenium.find_element(By.ID, "id_title").is_displayed()) self.take_screenshot("collapsed") - self.selenium.find_elements(By.LINK_TEXT, "Show")[0].click() + self.selenium.find_elements(By.TAG_NAME, "summary")[0].click() self.assertTrue(self.selenium.find_element(By.ID, "id_title").is_displayed()) - self.assertEqual( - self.selenium.find_element(By.ID, "fieldsetcollapser0").text, "Hide" - ) self.take_screenshot("expanded") @screenshot_cases(["desktop_size", "mobile_size", "rtl", "dark", "high_contrast"]) @@ -6104,7 +6099,7 @@ class SeleniumTests(AdminSeleniumTestCase): ) url = self.live_server_url + reverse("admin7:admin_views_pizza_add") self.selenium.get(url) - self.selenium.find_elements(By.ID, "fieldsetcollapser0")[0].click() + self.selenium.find_elements(By.TAG_NAME, "summary")[0].click() from_filter_box = self.selenium.find_element(By.ID, "id_toppings_filter") from_box = self.selenium.find_element(By.ID, "id_toppings_from") to_filter_box = self.selenium.find_element(By.ID, "id_toppings_filter_selected") |
