Skip to content

Commit f2d7e32

Browse files
committed
Update tests
1 parent 272f0af commit f2d7e32

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

djangocms_frontend/common/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
module = import_module(f"{__name__}.{settings.framework}.{module}", module)
2525
for cls in classes:
2626
globals()[cls] = getattr(module, cls)
27-
except ModuleNotFoundError:
27+
except ModuleNotFoundError: # pragma: no cover
2828
for cls in classes:
2929
globals()[cls] = type(cls, (object,), {})
3030

tests/content/test_plugins.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,15 @@ def test_figure_plugin(self):
7979
response = self.client.get(self.request_url)
8080
self.assertEqual(response.status_code, 200)
8181
self.assertContains(response, '<figcaption class="figure-caption')
82+
83+
def test_safe_caption_tag(self):
84+
from djangocms_frontend.templatetags.frontend import safe_caption
85+
86+
# no paragraphs: unchanged
87+
self.assertEqual(safe_caption("hello world"), "hello world")
88+
89+
# single paragraph: stripped
90+
self.assertEqual(safe_caption("<p>hello world</p>"), "hello world")
91+
92+
# multiple paragraphs: kept as is
93+
self.assertEqual(safe_caption("<p>hello</p><p>world</p>"), "<p>hello</p><p>world</p>")

0 commit comments

Comments
 (0)