summaryrefslogtreecommitdiff
path: root/tests/template_tests/syntax_tests
diff options
context:
space:
mode:
authorCraig Oldford <cj1982@gmail.com>2015-04-13 12:27:30 -0300
committerTim Graham <timograham@gmail.com>2015-04-14 07:19:47 -0400
commit75bc5bc634e90d5ccd2d7fc324df878dc5d4ce5d (patch)
tree31e9c1157b5df93e1da9ecf5d3c9d7208d4868dc /tests/template_tests/syntax_tests
parent6023312dde022d31d44373e8834431456095dc7c (diff)
downloaddjango-75bc5bc634e90d5ccd2d7fc324df878dc5d4ce5d.tar.gz
Fixed #12199 -- Added the ability to use "as" with the firstof template tag.
Diffstat (limited to 'tests/template_tests/syntax_tests')
-rw-r--r--tests/template_tests/syntax_tests/test_firstof.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/template_tests/syntax_tests/test_firstof.py b/tests/template_tests/syntax_tests/test_firstof.py
index 2c227f2304..a3c8c83151 100644
--- a/tests/template_tests/syntax_tests/test_firstof.py
+++ b/tests/template_tests/syntax_tests/test_firstof.py
@@ -81,3 +81,10 @@ class FirstOfTagTests(SimpleTestCase):
def test_firstof14(self):
output = self.engine.render_to_string('firstof14', {'a': '<'})
self.assertEqual(output, '<')
+
+ @setup({'firstof15': '{% firstof a b c as myvar %}'})
+ def test_firstof15(self):
+ ctx = {'a': 0, 'b': 2, 'c': 3}
+ output = self.engine.render_to_string('firstof15', ctx)
+ self.assertEqual(ctx['myvar'], '2')
+ self.assertEqual(output, '')