1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #29273 -- Prevented initial selection of empty choice in multiple choice widgets.

Regression in b52c73008a.
This commit is contained in:
Claude Paroz
2018-03-30 11:55:33 +02:00
committed by Tim Graham
parent d31a248c64
commit f3b69f9757
5 changed files with 19 additions and 5 deletions

View File

@@ -32,10 +32,12 @@ class CheckboxSelectMultipleTest(WidgetTest):
def test_render_none(self):
"""
If the value is None, none of the options are selected.
If the value is None, none of the options are selected, even if the
choices have an empty option.
"""
self.check_html(self.widget(choices=self.beatles), 'beatles', None, html=(
self.check_html(self.widget(choices=(('', 'Unknown'),) + self.beatles), 'beatles', None, html=(
"""<ul>
<li><label><input type="checkbox" name="beatles" value=""> Unknown</label></li>
<li><label><input type="checkbox" name="beatles" value="J"> John</label></li>
<li><label><input type="checkbox" name="beatles" value="P"> Paul</label></li>
<li><label><input type="checkbox" name="beatles" value="G"> George</label></li>