diff options
| author | Alexander Schrijver <alex@flupzor.nl> | 2016-07-16 22:55:40 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-08-09 09:05:17 -0400 |
| commit | 3ae3a1f9fad800d73892b14ac8a576e817a2da55 (patch) | |
| tree | 3ddbfc34b1c8f9dd76702b581f2364c4e7e85a71 /tests/template_tests/syntax_tests/test_cycle.py | |
| parent | 31e053edfa01e47c26dfa03834beeba77e09403a (diff) | |
Fixed #26830 -- Prevented the 'with' templatetag from resetting the cycle variable to its initial state.
Diffstat (limited to 'tests/template_tests/syntax_tests/test_cycle.py')
| -rw-r--r-- | tests/template_tests/syntax_tests/test_cycle.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/template_tests/syntax_tests/test_cycle.py b/tests/template_tests/syntax_tests/test_cycle.py index e98a7ec509..b5712b54bb 100644 --- a/tests/template_tests/syntax_tests/test_cycle.py +++ b/tests/template_tests/syntax_tests/test_cycle.py @@ -145,3 +145,25 @@ class CycleTagTests(SimpleTestCase): """ output = self.engine.render_to_string('cycle29', {'values': [1, 2, 3, 4, 5, 6, 7, 8, 8, 8, 9, 9]}) self.assertEqual(output, 'bcabcabcccaa') + + @setup({ + 'cycle30': "{% cycle 'a' 'b' 'c' as cycler silent %}" + "{% for x in values %}" + "{% with doesnothing=irrelevant %}" + "{% ifchanged x %}" + "{% cycle cycler %}{{ cycler }}" + "{% else %}" + "{{ cycler }}" + "{% endifchanged %}" + "{% endwith %}" + "{% endfor %}"}) + def test_cycle30(self): + """ + A {% with %} tag shouldn't reset the {% cycle %} variable. + """ + output = self.engine.render_to_string( + 'cycle30', { + 'irrelevant': 1, + 'values': [1, 2, 3, 4, 5, 6, 7, 8, 8, 8, 9, 9] + }) + self.assertEqual(output, 'bcabcabcccaa') |
