diff options
| author | antoliny0919 <antoliny0919@gmail.com> | 2025-07-29 18:03:52 +0900 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-07-30 15:36:56 +0200 |
| commit | 792ca148a2d6da6cf0778f6a866c899208ab94f9 (patch) | |
| tree | 9c7da74340775736c19a7caf6680173a4440a334 /tests | |
| parent | 94c2f3b99364bcf2d6d6b4afa8e995bd9d61ed0a (diff) | |
Fixed #36528, Refs #34917 -- Removed role="button" from object-tools links.
Regression in 849f8307a5bb33465252d0891a9b2c47dde65889.
In order to prevent underlines on links styled like buttons, role="button" was added.
This has been removed and the style updated to reflect that these are links.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/admin_views/tests.py | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 65241becc0..26fdacfa00 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -4086,7 +4086,7 @@ class AdminViewStringPrimaryKeyTest(TestCase): ) self.assertContains( response, - '<a role="button" href="%s" class="historylink"' % escape(expected_link), + '<a href="%s" class="historylink"' % escape(expected_link), ) def test_redirect_on_add_view_continue_button(self): @@ -6957,6 +6957,34 @@ class SeleniumTests(AdminSeleniumTestCase): save_button.click() @screenshot_cases(["desktop_size", "mobile_size", "rtl", "dark", "high_contrast"]) + def test_object_tools(self): + from selenium.webdriver.common.by import By + + state = State.objects.create(name="Korea") + city = City.objects.create(state=state, name="Gwangju") + self.admin_login( + username="super", password="secret", login_url=reverse("admin:index") + ) + self.selenium.get( + self.live_server_url + reverse("admin:admin_views_city_changelist") + ) + object_tools = self.selenium.find_elements( + By.CSS_SELECTOR, "ul.object-tools li a" + ) + self.assertEqual(len(object_tools), 1) + self.take_screenshot("changelist") + + self.selenium.get( + self.live_server_url + + reverse("admin:admin_views_city_change", args=(city.pk,)) + ) + object_tools = self.selenium.find_elements( + By.CSS_SELECTOR, "ul.object-tools li a" + ) + self.assertEqual(len(object_tools), 2) + self.take_screenshot("changeform") + + @screenshot_cases(["desktop_size", "mobile_size", "rtl", "dark", "high_contrast"]) def test_long_header_with_object_tools_layout(self): from selenium.webdriver.common.by import By @@ -8415,7 +8443,7 @@ class AdminKeepChangeListFiltersTests(TestCase): # Check the history link. history_link = re.search( - '<a role="button" href="(.*?)" class="historylink">History</a>', + '<a href="(.*?)" class="historylink">History</a>', response.text, ) self.assertURLEqual(history_link[1], self.get_history_url()) |
