Ticket #27723: 27723.diff

File 27723.diff, 1.5 KB (added by Mariusz Felisiak, 8 years ago)
  • tests/forms_tests/widget_tests/test_multiwidget.py

    diff --git a/tests/forms_tests/widget_tests/test_multiwidget.py b/tests/forms_tests/widget_tests/test_multiwidget.py
    index a7cd8e0..70fc078 100644
    a b class MultiWidgetTest(WidgetTest):  
    118118            '<input id="bar_1" type="text" class="small" value="lennon" name="name_1" />'
    119119        ))
    120120
     121    def test_attrs_with_type(self):
     122        attrs = {'type': 'date'}
     123        widget = MyMultiWidget(widgets=(TextInput, TextInput), attrs=attrs)
     124        self.check_html(widget, 'name', ['john', 'lennon'], html=(
     125            '<input type="date" value="john" name="name_0" />'
     126            '<input type="date" value="lennon" name="name_1" />'
     127        ))
     128        widget = MyMultiWidget(widgets=(TextInput(attrs), TextInput(attrs)), attrs={'attrs': 'number'})
     129        self.check_html(widget, 'name', ['john', 'lennon'], html=(
     130            '<input type="date" value="john" name="name_0" />'
     131            '<input type="date" value="lennon" name="name_1" />'
     132        ))
     133        widget = MyMultiWidget(widgets=(TextInput(), TextInput()), attrs=attrs)
     134        self.check_html(widget, 'name', ['john', 'lennon'], html=(
     135            '<input type="text" value="john" name="name_0" />'
     136            '<input type="text" value="lennon" name="name_1" />'
     137        ))
     138
    121139    def test_value_omitted_from_data(self):
    122140        widget = MyMultiWidget(widgets=(TextInput(), TextInput()))
    123141        self.assertIs(widget.value_omitted_from_data({}, {}, 'field'), True)
Back to Top