2015-08-31 02:13:42 +00:00
|
|
|
from django.forms import HiddenInput
|
|
|
|
|
|
|
|
from .base import WidgetTest
|
|
|
|
|
|
|
|
|
|
|
|
class HiddenInputTest(WidgetTest):
|
|
|
|
widget = HiddenInput()
|
|
|
|
|
|
|
|
def test_render(self):
|
2022-02-03 19:24:19 +00:00
|
|
|
self.check_html(
|
|
|
|
self.widget, "email", "", html='<input type="hidden" name="email">'
|
|
|
|
)
|
2016-08-12 17:59:01 +00:00
|
|
|
|
|
|
|
def test_use_required_attribute(self):
|
|
|
|
# Always False to avoid browser validation on inputs hidden from the
|
|
|
|
# user.
|
|
|
|
self.assertIs(self.widget.use_required_attribute(None), False)
|
2022-02-03 19:24:19 +00:00
|
|
|
self.assertIs(self.widget.use_required_attribute(""), False)
|
|
|
|
self.assertIs(self.widget.use_required_attribute("foo"), False)
|