diff --git a/tests/admin_inlines/admin.py b/tests/admin_inlines/admin.py index 3b018aa5d750..c3983985c350 100644 --- a/tests/admin_inlines/admin.py +++ b/tests/admin_inlines/admin.py @@ -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"}, ), ] diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py index 04f0a37e0284..620aac10a8a7 100644 --- a/tests/admin_inlines/tests.py +++ b/tests/admin_inlines/tests.py @@ -2422,3 +2422,39 @@ def test_inlines_verbose_name(self): ) 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"), + [], + )