Skip to content

Commit

Permalink
add logic for both cms < 4.1 and cms > 4.1 in test_admin
Browse files Browse the repository at this point in the history
  • Loading branch information
FreemanPancake committed Oct 30, 2024
1 parent 1858a8f commit 9163995
Showing 1 changed file with 32 additions and 12 deletions.
44 changes: 32 additions & 12 deletions tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2085,9 +2085,14 @@ def test_menucontent_changelist_url_link_opens_in_sideframe(self):
request.menu_content_id = menucontent.pk
url_markup = self.menucontent_modeladmin._get_edit_link(menucontent, request)

# The url link should keep the sideframe close
self.assertNotIn("js-keep-sideframe", url_markup)
self.assertIn("js-close-sideframe", url_markup)
if CMS_41:
# The url link should keep the sideframe close
self.assertNotIn("js-keep-sideframe", url_markup)
self.assertIn("js-close-sideframe", url_markup)
else:
# The url link should keep the sideframe open
self.assertIn("js-versioning-keep-sideframe", url_markup)
self.assertNotIn("js-versioning-close-sideframe", url_markup)

def test_menucontent_preview_link_opens_in_sideframe(self):
"""
Expand All @@ -2100,9 +2105,14 @@ def test_menucontent_preview_link_opens_in_sideframe(self):
request.menu_content_id = menucontent.pk
url_markup = self.menucontent_modeladmin._get_preview_link(menucontent, request)

# The url link should keep the sideframe close
self.assertNotIn("js-keep-sideframe", url_markup)
self.assertIn("js-close-sideframe", url_markup)
if CMS_41:
# The url link should keep the sideframe close
self.assertNotIn("js-keep-sideframe", url_markup)
self.assertIn("js-close-sideframe", url_markup)
else:
# The url link should keep the sideframe open
self.assertIn("js-versioning-keep-sideframe", url_markup)
self.assertNotIn("js-versioning-close-sideframe", url_markup)

def test_menuitem_changelist_edit_url_link_opens_in_sideframe(self):
"""
Expand All @@ -2117,9 +2127,14 @@ def test_menuitem_changelist_edit_url_link_opens_in_sideframe(self):
request.menu_content_id = menucontent.pk
url_markup = self.menuitem_modeladmin._get_edit_link(child, request)

# The url link should keep the sideframe close
self.assertNotIn("js-keep-sideframe", url_markup)
self.assertIn("js-close-sideframe", url_markup)
if CMS_41:
# The url link should keep the sideframe close
self.assertNotIn("js-keep-sideframe", url_markup)
self.assertIn("js-close-sideframe", url_markup)
else:
# The url link should keep the sideframe open
self.assertIn("js-versioning-keep-sideframe", url_markup)
self.assertNotIn("js-versioning-close-sideframe", url_markup)

def test_menuitem_changelist_delete_url_link_opens_in_sideframe(self):
"""
Expand All @@ -2134,9 +2149,14 @@ def test_menuitem_changelist_delete_url_link_opens_in_sideframe(self):
request.menu_content_id = menucontent.pk
url_markup = self.menuitem_modeladmin._get_delete_link(child, request)

# The url link should keep the sideframe close
self.assertIn("js-keep-sideframe", url_markup)
self.assertNotIn("js-close-sideframe", url_markup)
if CMS_41:
# The url link should keep the sideframe close
self.assertNotIn("js-keep-sideframe", url_markup)
self.assertIn("js-close-sideframe", url_markup)
else:
# The url link should keep the sideframe open
self.assertIn("js-versioning-keep-sideframe", url_markup)
self.assertNotIn("js-versioning-close-sideframe", url_markup)


class ReferencesIntegrationTestCase(CMSTestCase):
Expand Down

0 comments on commit 9163995

Please sign in to comment.