diff options
| author | rajeeshp <rajeeshrpunathil@gmail.com> | 2023-05-19 14:41:36 +0530 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-05-19 13:16:42 +0200 |
| commit | a2da81fe083a9dbc37b8355c25fdc23e3b58d16f (patch) | |
| tree | 209424c9dd5c44fec97f517af56a6fc1751d4cd4 /tests/template_tests | |
| parent | fce90950bef348803fa7cc3e6bc65f4bce429b82 (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.py | 18 |
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 & 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><br><img><br></a>", + "<a><br><img><br></a>", ) def test_noniterable_arg(self): |
