File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed
Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 22
33
44def pytest_configure ():
5- settings .configure (INSTALLED_APPS = ["django_mermaid.apps.MermaidConfig" ])
5+ settings .configure (
6+ INSTALLED_APPS = [
7+ "django_mermaid.apps.MermaidConfig"
8+ ],
9+ TEMPLATES = [
10+ {
11+ "BACKEND" : "django.template.backends.django.DjangoTemplates" ,
12+ },
13+ ]
14+ )
Original file line number Diff line number Diff line change 1+ from django .template import Context
2+ from django .template import Template
3+
14from django_mermaid .templatetags .mermaid import mermaid
25
36
@@ -6,3 +9,21 @@ def test_tag_renders():
69 """<div class="mermaid">graph LR; A-->B;</div><script src="mermaid.js"></script>"""
710 """<script>mermaid.initialize({"startOnLoad": true, theme: "default"});</script>"""
811 )
12+
13+
14+ def test_tag_use_in_template ():
15+ template = Template ("{% load mermaid %}{% mermaid content %}" )
16+ template = template .render (Context ({"content" : "graph LR; A-->B;" }))
17+ assert template == (
18+ """<div class="mermaid">graph LR; A-->B;</div><script src="mermaid.js"></script>"""
19+ """<script>mermaid.initialize({"startOnLoad": true, theme: "default"});</script>"""
20+ )
21+
22+
23+ def test_tag_use_in_template_with_arguments ():
24+ template = Template ("{% load mermaid %}{% mermaid content \" forest\" %}" )
25+ template = template .render (Context ({"content" : "graph LR; A-->B;" }))
26+ assert template == (
27+ """<div class="mermaid">graph LR; A-->B;</div><script src="mermaid.js"></script>"""
28+ """<script>mermaid.initialize({"startOnLoad": true, theme: "forest"});</script>"""
29+ )
You can’t perform that action at this time.
0 commit comments