mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #27723 -- Set MultiWidget's subwidgets input type from attrs argument.
Regression in b52c73008a
.
This commit is contained in:
parent
3226536127
commit
974d14534c
2 changed files with 16 additions and 0 deletions
|
@ -118,6 +118,19 @@ class MultiWidgetTest(WidgetTest):
|
|||
'<input id="bar_1" type="text" class="small" value="lennon" name="name_1" />'
|
||||
))
|
||||
|
||||
def test_constructor_attrs_with_type(self):
|
||||
attrs = {'type': 'number'}
|
||||
widget = MyMultiWidget(widgets=(TextInput, TextInput()), attrs=attrs)
|
||||
self.check_html(widget, 'code', ['1', '2'], html=(
|
||||
'<input type="number" value="1" name="code_0" />'
|
||||
'<input type="number" value="2" name="code_1" />'
|
||||
))
|
||||
widget = MyMultiWidget(widgets=(TextInput(attrs), TextInput(attrs)), attrs={'class': 'bar'})
|
||||
self.check_html(widget, 'code', ['1', '2'], html=(
|
||||
'<input type="number" value="1" name="code_0" class="bar" />'
|
||||
'<input type="number" value="2" name="code_1" class="bar" />'
|
||||
))
|
||||
|
||||
def test_value_omitted_from_data(self):
|
||||
widget = MyMultiWidget(widgets=(TextInput(), TextInput()))
|
||||
self.assertIs(widget.value_omitted_from_data({}, {}, 'field'), True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue