Skip to content

Commit 526017d

Browse files
committed
GH-20: Add a test case for the new setting property
1 parent 7c755c1 commit 526017d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test_tag.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,24 @@ def test_tag_use_in_template(version, template_code):
3636
)
3737

3838

39+
@override_settings(MERMAID_USE_CDN=True)
40+
@pytest.mark.parametrize(
41+
"template_code",
42+
[
43+
"{% load mermaid %}{% mermaid content %}",
44+
"{% load mermaid %}{% startmermaid %}{{ content|safe }}{% endmermaid %}"
45+
]
46+
)
47+
def test_tag_use_mermaid_cdn(version, template_code):
48+
template = Template(template_code)
49+
template = template.render(Context({"content": "graph LR; A-->B;"}))
50+
assert template == (
51+
"<div class=\"mermaid\">graph LR; A-->B;</div><script src=\"https://cdnjs.cloudflare.com/ajax/libs/mermaid/%s/mermaid.min.js\"></script>"
52+
"<script>mermaid.initialize({\"startOnLoad\": true, \"theme\": \"default\", \"themeVariables\""
53+
": {}});</script>" % version
54+
)
55+
56+
3957
@override_settings(MERMAID_THEME="forest")
4058
@pytest.mark.parametrize(
4159
"template_code",

0 commit comments

Comments
 (0)