summaryrefslogtreecommitdiff
path: root/tests/template_tests
diff options
context:
space:
mode:
authorcheng <chengyuan.china@gmail.com>2022-07-13 23:11:17 -0700
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-07-14 11:09:19 +0200
commitd4c5d2b52c897ccc07f04482d3f42f976a79223c (patch)
tree0e5d71b862c42826ab1f8ac61e16018d011b84df /tests/template_tests
parent7faf25d682b8e8f4fd2006eb7dfc71ed2a2193b7 (diff)
downloaddjango-d4c5d2b52c897ccc07f04482d3f42f976a79223c.tar.gz
Fixed #33631 -- Marked {% blocktranslate asvar %} result as HTML safe.
Diffstat (limited to 'tests/template_tests')
-rw-r--r--tests/template_tests/syntax_tests/i18n/test_blocktranslate.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/template_tests/syntax_tests/i18n/test_blocktranslate.py b/tests/template_tests/syntax_tests/i18n/test_blocktranslate.py
index 4a162362c6..4c9036ba76 100644
--- a/tests/template_tests/syntax_tests/i18n/test_blocktranslate.py
+++ b/tests/template_tests/syntax_tests/i18n/test_blocktranslate.py
@@ -418,6 +418,22 @@ class I18nBlockTransTagTests(SimpleTestCase):
@setup(
{
+ "i18n_asvar_safestring": (
+ "{% load i18n %}"
+ "{% blocktranslate asvar the_title %}"
+ "{{title}}other text"
+ "{% endblocktranslate %}"
+ "{{ the_title }}"
+ )
+ }
+ )
+ def test_i18n_asvar_safestring(self):
+ context = {"title": "<Main Title>"}
+ output = self.engine.render_to_string("i18n_asvar_safestring", context=context)
+ self.assertEqual(output, "&lt;Main Title&gt;other text")
+
+ @setup(
+ {
"template": (
"{% load i18n %}{% blocktranslate asvar %}Yes{% endblocktranslate %}"
)