summaryrefslogtreecommitdiff
path: root/tests/template_tests/syntax_tests/test_if_changed.py
diff options
context:
space:
mode:
authorkapil garg <kapilgarg1996@users.noreply.github.com>2017-04-04 07:59:39 +0530
committerTim Graham <timograham@gmail.com>2017-04-03 22:29:39 -0400
commit002fe076225c2aa6e389481b038f55acb6f807d0 (patch)
treefa7930ec59f0cc19840289df06edfed69c299246 /tests/template_tests/syntax_tests/test_if_changed.py
parentef8a339dfbe65e207c8945d114c60462a71da034 (diff)
Fixed #27974 -- Kept resolved templates constant during one rendering cycle.
Thanks Florian Apolloner for the initial patch.
Diffstat (limited to 'tests/template_tests/syntax_tests/test_if_changed.py')
-rw-r--r--tests/template_tests/syntax_tests/test_if_changed.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/template_tests/syntax_tests/test_if_changed.py b/tests/template_tests/syntax_tests/test_if_changed.py
index 889a24fcd8..2e6b2c9684 100644
--- a/tests/template_tests/syntax_tests/test_if_changed.py
+++ b/tests/template_tests/syntax_tests/test_if_changed.py
@@ -212,3 +212,14 @@ class IfChangedTests(SimpleTestCase):
])
output = engine.render_to_string('template', dict(vars=[1, 1, 2, 2, 3, 3]))
self.assertEqual(output, "123")
+
+ def test_include_state(self):
+ """Tests the node state for different IncludeNodes (#27974)."""
+ engine = Engine(loaders=[
+ ('django.template.loaders.locmem.Loader', {
+ 'template': '{% for x in vars %}{% include "include" %}{% include "include" %}{% endfor %}',
+ 'include': '{% ifchanged %}{{ x }}{% endifchanged %}',
+ }),
+ ])
+ output = engine.render_to_string('template', dict(vars=[1, 1, 2, 2, 3, 3]))
+ self.assertEqual(output, '112233')