2016-09-06 21:41:54 +00:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from django.forms import Widget
|
2017-01-07 00:11:32 +00:00
|
|
|
from django.forms.widgets import Input
|
2016-09-06 21:41:54 +00:00
|
|
|
|
2017-01-07 00:11:32 +00:00
|
|
|
from .base import WidgetTest
|
2016-09-06 21:41:54 +00:00
|
|
|
|
2017-01-07 00:11:32 +00:00
|
|
|
|
|
|
|
class WidgetTests(WidgetTest):
|
2016-09-06 21:41:54 +00: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 00:11:32 +00: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" />')
|