2017-01-10 19:30:10 +08:00
|
|
|
from django.forms.widgets import Input
|
|
|
|
|
|
|
|
from .base import WidgetTest
|
|
|
|
|
|
|
|
|
|
|
|
class InputTests(WidgetTest):
|
|
|
|
|
|
|
|
def test_attrs_with_type(self):
|
|
|
|
attrs = {'type': 'date'}
|
|
|
|
widget = Input(attrs)
|
2018-01-21 15:09:10 +08:00
|
|
|
self.check_html(widget, 'name', 'value', '<input type="date" name="name" value="value">')
|
2017-01-10 19:30:10 +08:00
|
|
|
# reuse the same attrs for another widget
|
2018-01-21 15:09:10 +08:00
|
|
|
self.check_html(Input(attrs), 'name', 'value', '<input type="date" name="name" value="value">')
|
2017-01-10 19:30:10 +08:00
|
|
|
attrs['type'] = 'number' # shouldn't change the widget type
|
2018-01-21 15:09:10 +08:00
|
|
|
self.check_html(widget, 'name', 'value', '<input type="date" name="name" value="value">')
|