Fixed #35892 -- Supported Widget.use_fieldset in admin forms.

This commit is contained in:
antoliny0919
2025-07-28 07:59:26 +09:00
committed by Sarah Boyce
parent ad4a9e0f3b
commit 4187da258f
22 changed files with 193 additions and 39 deletions

View File

@@ -246,18 +246,19 @@ class ClearableFileInputTest(WidgetTest):
)
form = TestForm()
self.assertIs(self.widget.use_fieldset, False)
self.assertIs(self.widget.use_fieldset, True)
self.assertHTMLEqual(
'<div><label for="id_field">Field:</label>'
'<input id="id_field" name="field" type="file" required></div>'
'<div><label for="id_with_file">With file:</label>Currently: '
'<div><fieldset><legend for="id_field">Field:</legend>'
'<input id="id_field" name="field" type="file" required></fieldset></div>'
'<div><fieldset><legend for="id_with_file">With file:</legend>Currently: '
'<a href="something">something</a><br>Change:<input type="file" '
'name="with_file" id="id_with_file"></div>'
'<div><label for="id_clearable_file">Clearable file:</label>'
'name="with_file" id="id_with_file"></fieldset></div>'
'<div><fieldset><legend for="id_clearable_file">Clearable file:</legend>'
'Currently: <a href="something">something</a><input '
'type="checkbox" name="clearable_file-clear" id="clearable_file-clear_id">'
'<label for="clearable_file-clear_id">Clear</label><br>Change:'
'<input type="file" name="clearable_file" id="id_clearable_file"></div>',
'<input type="file" name="clearable_file" id="id_clearable_file">'
"</fieldset></div>",
form.render(),
)