diff options
| author | Alexander Schrijver <alex@flupzor.nl> | 2016-07-16 22:54:08 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-08-09 08:47:09 -0400 |
| commit | 31e053edfa01e47c26dfa03834beeba77e09403a (patch) | |
| tree | 07682711d562ae1a5c0c229004132f9a26206a29 /tests/template_tests/syntax_tests | |
| parent | f95bd89e827d6ee46cc6c736dadc25a10ae25fc9 (diff) | |
Refs #26830 -- Added a test for a named cycle template tag inside an ifchanged block and a for loop.
Diffstat (limited to 'tests/template_tests/syntax_tests')
| -rw-r--r-- | tests/template_tests/syntax_tests/test_cycle.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/template_tests/syntax_tests/test_cycle.py b/tests/template_tests/syntax_tests/test_cycle.py index 13073ef26d..e98a7ec509 100644 --- a/tests/template_tests/syntax_tests/test_cycle.py +++ b/tests/template_tests/syntax_tests/test_cycle.py @@ -127,3 +127,21 @@ class CycleTagTests(SimpleTestCase): def test_cycle28(self): output = self.engine.render_to_string('cycle28', {'a': '<', 'b': '>'}) self.assertEqual(output, '<>') + + @setup({ + 'cycle29': "{% cycle 'a' 'b' 'c' as cycler silent %}" + "{% for x in values %}" + "{% ifchanged x %}" + "{% cycle cycler %}{{ cycler }}" + "{% else %}" + "{{ cycler }}" + "{% endifchanged %}" + "{% endfor %}" + }) + def test_cycle29(self): + """ + A named {% cycle %} tag works inside an {% ifchanged %} block and a + {% for %} loop. + """ + output = self.engine.render_to_string('cycle29', {'values': [1, 2, 3, 4, 5, 6, 7, 8, 8, 8, 9, 9]}) + self.assertEqual(output, 'bcabcabcccaa') |
