diff options
author | cheng <chengyuan.china@gmail.com> | 2022-07-13 23:11:17 -0700 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-07-14 11:09:19 +0200 |
commit | d4c5d2b52c897ccc07f04482d3f42f976a79223c (patch) | |
tree | 0e5d71b862c42826ab1f8ac61e16018d011b84df /tests/template_tests | |
parent | 7faf25d682b8e8f4fd2006eb7dfc71ed2a2193b7 (diff) | |
download | django-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.py | 16 |
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, "<Main Title>other text") + + @setup( + { "template": ( "{% load i18n %}{% blocktranslate asvar %}Yes{% endblocktranslate %}" ) |