Skip to content

Commit

Permalink
Fix test for Wagtail 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
zerolab committed Feb 5, 2024
1 parent 5260b09 commit 9201673
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,19 @@ def test_media_field_in_admin(self):
args=("wagtailmedia_tests", "eventpage", self.root_page.id),
)
)
self.assertContains(
response,
'<script>createMediaChooser("id_related_media-__prefix__-link_media");</script>',
)

from wagtail import VERSION as WAGTAIL_VERSION

if WAGTAIL_VERSION >= (4, 2):
self.assertContains(
response,
'<script>createMediaChooser("id_related_media-__prefix__-link_media");</script>',
)
else:
self.assertContains(
response,
'<script>createMediaChooser("id_related_media-__prefix__-link_media");<-/script>',
)
self.assertContains(response, "media-chooser.js")

def test_media_block_in_admin(self):
Expand Down

0 comments on commit 9201673

Please sign in to comment.