1
0
mirror of https://github.com/django/django.git synced 2025-01-23 08:39:17 +00:00
Jon Dufresne 5fa390ee81 Fixed #27759 -- Prevented forms attrs.html template from rendering False attrs.
Regression in b52c73008a9d67e9ddbb841872dc15cdd3d6ee01.
2017-01-23 08:49:00 -05:00

20 lines
743 B
Python

from django.forms import Widget
from django.forms.widgets import Input
from .base import WidgetTest
class WidgetTests(WidgetTest):
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)
def test_no_trailing_newline_in_attrs(self):
self.check_html(Input(), 'name', 'value', strict=True, html='<input type="None" name="name" value="value" />')
def test_attr_false_not_rendered(self):
html = '<input type="None" name="name" value="value" />'
self.check_html(Input(), 'name', 'value', html=html, attrs={'readonly': False})