Refs #26830 -- Added a test for a named cycle template tag inside an ifchanged block and a for loop.
This commit is contained in:
parent
f95bd89e82
commit
31e053edfa
@ -127,3 +127,21 @@ class CycleTagTests(SimpleTestCase):
|
|||||||
def test_cycle28(self):
|
def test_cycle28(self):
|
||||||
output = self.engine.render_to_string('cycle28', {'a': '<', 'b': '>'})
|
output = self.engine.render_to_string('cycle28', {'a': '<', 'b': '>'})
|
||||||
self.assertEqual(output, '<>')
|
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')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user