mirror of
https://github.com/django/django.git
synced 2024-12-22 09:05:43 +00:00
Refs #35464 -- Added test to cover layout of TabularInline fieldsets.
This commit is contained in:
parent
b5f4d76bc4
commit
65344f0e1e
@ -106,14 +106,18 @@ class PhotoInlineMixin:
|
||||
model = Photo
|
||||
extra = 2
|
||||
fieldsets = [
|
||||
(None, {"fields": ["image", "title"]}),
|
||||
(None, {"fields": ["image", "title"], "description": "First group"}),
|
||||
(
|
||||
"Details",
|
||||
{"fields": ["description", "creation_date"], "classes": ["collapse"]},
|
||||
{
|
||||
"fields": ["description", "creation_date"],
|
||||
"classes": ["collapse"],
|
||||
"description": "Second group",
|
||||
},
|
||||
),
|
||||
(
|
||||
"Details", # Fieldset name intentionally duplicated
|
||||
{"fields": ["update_date", "updated_by"]},
|
||||
{"fields": ["update_date", "updated_by"], "description": "Third group"},
|
||||
),
|
||||
]
|
||||
|
||||
|
@ -2422,3 +2422,39 @@ class SeleniumTests(AdminSeleniumTestCase):
|
||||
)
|
||||
self.assertEqual(available.text, "AVAILABLE ATTENDANT")
|
||||
self.assertEqual(chosen.text, "CHOSEN ATTENDANT")
|
||||
|
||||
def test_tabular_inline_layout(self):
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
self.admin_login(username="super", password="secret")
|
||||
self.selenium.get(
|
||||
self.live_server_url + reverse("admin:admin_inlines_photographer_add")
|
||||
)
|
||||
tabular_inline = self.selenium.find_element(
|
||||
By.CSS_SELECTOR, "[data-inline-type='tabular']"
|
||||
)
|
||||
headers = tabular_inline.find_elements(By.TAG_NAME, "th")
|
||||
self.assertEqual(
|
||||
[h.get_attribute("innerText") for h in headers],
|
||||
[
|
||||
"",
|
||||
"IMAGE",
|
||||
"TITLE",
|
||||
"DESCRIPTION",
|
||||
"CREATION DATE",
|
||||
"UPDATE DATE",
|
||||
"UPDATED BY",
|
||||
"DELETE?",
|
||||
],
|
||||
)
|
||||
# There are no fieldset section names rendered.
|
||||
self.assertNotIn("Details", tabular_inline.text)
|
||||
# There are no fieldset section descriptions rendered.
|
||||
self.assertNotIn("First group", tabular_inline.text)
|
||||
self.assertNotIn("Second group", tabular_inline.text)
|
||||
self.assertNotIn("Third group", tabular_inline.text)
|
||||
# There are no fieldset classes applied.
|
||||
self.assertEqual(
|
||||
tabular_inline.find_elements(By.CSS_SELECTOR, ".collapse"),
|
||||
[],
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user