summaryrefslogtreecommitdiff
path: root/tests/template_tests
diff options
context:
space:
mode:
authorrajeeshp <rajeeshrpunathil@gmail.com>2023-05-19 14:41:36 +0530
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-05-19 13:16:42 +0200
commita2da81fe083a9dbc37b8355c25fdc23e3b58d16f (patch)
tree209424c9dd5c44fec97f517af56a6fc1751d4cd4 /tests/template_tests
parentfce90950bef348803fa7cc3e6bc65f4bce429b82 (diff)
Fixed #34578 -- Made "join" template filter respect autoescape for joiner.
Diffstat (limited to 'tests/template_tests')
-rw-r--r--tests/template_tests/filter_tests/test_join.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/template_tests/filter_tests/test_join.py b/tests/template_tests/filter_tests/test_join.py
index 08f68537ee..b92b732972 100644
--- a/tests/template_tests/filter_tests/test_join.py
+++ b/tests/template_tests/filter_tests/test_join.py
@@ -55,6 +55,22 @@ class JoinTests(SimpleTestCase):
)
self.assertEqual(output, "alpha & beta &amp; me")
+ @setup(
+ {
+ "join_autoescape_off": (
+ "{% autoescape off %}"
+ "{{ var_list|join:var_joiner }}"
+ "{% endautoescape %}"
+ ),
+ }
+ )
+ def test_join_autoescape_off(self):
+ var_list = ["<p>Hello World!</p>", "beta & me", "<script>Hi!</script>"]
+ context = {"var_list": var_list, "var_joiner": "<br/>"}
+ output = self.engine.render_to_string("join_autoescape_off", context)
+ expected_result = "<p>Hello World!</p><br/>beta & me<br/><script>Hi!</script>"
+ self.assertEqual(output, expected_result)
+
class FunctionTests(SimpleTestCase):
def test_list(self):
@@ -69,7 +85,7 @@ class FunctionTests(SimpleTestCase):
def test_autoescape_off(self):
self.assertEqual(
join(["<a>", "<img>", "</a>"], "<br>", autoescape=False),
- "<a>&lt;br&gt;<img>&lt;br&gt;</a>",
+ "<a><br><img><br></a>",
)
def test_noniterable_arg(self):