1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #24451 -- Deprecated comma-separated {% cycle %} syntax.

This commit is contained in:
Tim Graham
2015-03-05 12:38:42 -05:00
parent 88c605e3e3
commit c36b60836b
6 changed files with 36 additions and 10 deletions

View File

@@ -124,14 +124,14 @@ class IfChangedTagTests(SimpleTestCase):
self.assertEqual(output, '1-first,1-other,2-first,2-other,2-other,3-first,')
@setup({'ifchanged-else02': '{% for id in ids %}{{ id }}-'
'{% ifchanged id %}{% cycle red,blue %}{% else %}grey{% endifchanged %}'
'{% ifchanged id %}{% cycle "red" "blue" %}{% else %}grey{% endifchanged %}'
',{% endfor %}'})
def test_ifchanged_else02(self):
output = self.engine.render_to_string('ifchanged-else02', {'ids': [1, 1, 2, 2, 2, 3]})
self.assertEqual(output, '1-red,1-grey,2-blue,2-grey,2-grey,3-red,')
@setup({'ifchanged-else03': '{% for id in ids %}{{ id }}'
'{% ifchanged id %}-{% cycle red,blue %}{% else %}{% endifchanged %}'
'{% ifchanged id %}-{% cycle "red" "blue" %}{% else %}{% endifchanged %}'
',{% endfor %}'})
def test_ifchanged_else03(self):
output = self.engine.render_to_string('ifchanged-else03', {'ids': [1, 1, 2, 2, 2, 3]})