mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #32339 -- Added use_fieldset to Widget.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from django.forms import CheckboxInput
|
||||
from django.forms import BooleanField, CheckboxInput, Form
|
||||
|
||||
from .base import WidgetTest
|
||||
|
||||
@@ -124,3 +124,16 @@ class CheckboxInputTest(WidgetTest):
|
||||
attrs = {"checked": False}
|
||||
self.widget.get_context("name", True, attrs)
|
||||
self.assertIs(attrs["checked"], False)
|
||||
|
||||
def test_fieldset(self):
|
||||
class TestForm(Form):
|
||||
template_name = "forms_tests/use_fieldset.html"
|
||||
field = BooleanField(widget=self.widget)
|
||||
|
||||
form = TestForm()
|
||||
self.assertIs(self.widget.use_fieldset, False)
|
||||
self.assertHTMLEqual(
|
||||
form.render(),
|
||||
'<div><label for="id_field">Field:</label>'
|
||||
'<input id="id_field" name="field" required type="checkbox"></div>',
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user