2016-09-07 05:41:54 +08:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from django.forms import Widget
|
2017-01-07 08:11:32 +08:00
|
|
|
from django.forms.widgets import Input
|
2016-09-07 05:41:54 +08:00
|
|
|
|
2017-01-07 08:11:32 +08:00
|
|
|
from .base import WidgetTest
|
2016-09-07 05:41:54 +08:00
|
|
|
|
2017-01-07 08:11:32 +08:00
|
|
|
|
|
|
|
class WidgetTests(WidgetTest):
|
2016-09-07 05:41:54 +08:00
|
|
|
|
|
|
|
def test_value_omitted_from_data(self):
|
|
|
|
widget = Widget()
|
|
|
|
self.assertIs(widget.value_omitted_from_data({}, {}, 'field'), True)
|
|
|
|
self.assertIs(widget.value_omitted_from_data({'field': 'value'}, {}, 'field'), False)
|
2017-01-07 08:11:32 +08:00
|
|
|
|
|
|
|
def test_no_trailing_newline_in_attrs(self):
|
|
|
|
self.check_html(Input(), 'name', 'value', strict=True, html='<input type="None" name="name" value="value" />')
|