1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #36528, Refs #34917 -- Removed role="button" from object-tools links.

Regression in 849f8307a5.
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.
This commit is contained in:
antoliny0919
2025-07-29 18:03:52 +09:00
committed by Sarah Boyce
parent 94c2f3b993
commit 792ca148a2
4 changed files with 34 additions and 5 deletions

View File

@@ -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):
@@ -6956,6 +6956,34 @@ class SeleniumTests(AdminSeleniumTestCase):
with self.wait_page_loaded():
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())