diff options
| author | Roger Gammans <rgammans@gammascience.co.uk> | 2018-01-25 12:14:44 +0000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-01-25 13:40:51 -0500 |
| commit | d0b44c44ef6ac8b6a7e332b83b9932f23dee41fd (patch) | |
| tree | c641ce16930bf8c5e1f205a297f355c7452a96f1 /tests/template_tests/syntax_tests | |
| parent | 8dc675d90f14a84ef95f16c7cc8100d9a04459b3 (diff) | |
Fixed #29060 -- Made {% firstof %} assign '' to the asvar if all inputs are false.
Diffstat (limited to 'tests/template_tests/syntax_tests')
| -rw-r--r-- | tests/template_tests/syntax_tests/test_firstof.py | 7 |
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 1f382a6db3..cc8df211eb 100644 --- a/tests/template_tests/syntax_tests/test_firstof.py +++ b/tests/template_tests/syntax_tests/test_firstof.py @@ -82,3 +82,10 @@ class FirstOfTagTests(SimpleTestCase): output = self.engine.render_to_string('firstof15', ctx) self.assertEqual(ctx['myvar'], '2') self.assertEqual(output, '') + + @setup({'firstof16': '{% firstof a b c as myvar %}'}) + def test_all_false_arguments_asvar(self): + ctx = {'a': 0, 'b': 0, 'c': 0} + output = self.engine.render_to_string('firstof16', ctx) + self.assertEqual(ctx['myvar'], '') + self.assertEqual(output, '') |
