summaryrefslogtreecommitdiff
path: root/tests/regressiontests/forms
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2011-11-21 10:11:06 +0000
committerAymeric Augustin <aymeric.augustin@m4x.org>2011-11-21 10:11:06 +0000
commit19e54084dc7d85d0bf190e0d79575126c5d29a50 (patch)
treec3728ad035aec06c1d0f19cd02434a0e4503f812 /tests/regressiontests/forms
parent0a272e42012d0c727e09bd8956f58a0ef0337735 (diff)
Fixed #17114 -- Handled integer values 0 and 1 for checkboxes like other integer values, not like False and True.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17132 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/forms')
-rw-r--r--tests/regressiontests/forms/tests/widgets.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/tests/widgets.py b/tests/regressiontests/forms/tests/widgets.py
index b567ea370e..ac78ad701b 100644
--- a/tests/regressiontests/forms/tests/widgets.py
+++ b/tests/regressiontests/forms/tests/widgets.py
@@ -195,6 +195,10 @@ class FormsWidgetTestCase(TestCase):
self.assertEqual(w.render('is_cool', False, attrs={'class': 'pretty'}), u'<input type="checkbox" name="is_cool" class="pretty" />')
+ # regression for #17114
+ self.assertEqual(w.render('is_cool', 0), u'<input checked="checked" type="checkbox" name="is_cool" value="0" />')
+ self.assertEqual(w.render('is_cool', 1), u'<input checked="checked" type="checkbox" name="is_cool" value="1" />')
+
# You can also pass 'attrs' to the constructor:
w = CheckboxInput(attrs={'class': 'pretty'})
self.assertEqual(w.render('is_cool', ''), u'<input type="checkbox" class="pretty" name="is_cool" />')