1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #31536 -- Fixed rendering of disabled AdminFileWidget and ClearableFileInput.

This commit is contained in:
Carles Pina
2020-05-04 17:41:38 +02:00
committed by Mariusz Felisiak
parent 578b3046e3
commit e46c2326c8
5 changed files with 32 additions and 3 deletions

View File

@@ -74,6 +74,21 @@ class ClearableFileInputTest(WidgetTest):
"""
self.check_html(self.widget, 'myfile', None, html='<input type="file" name="myfile">')
def test_render_disabled(self):
self.check_html(
self.widget,
'myfile',
FakeFieldFile(),
attrs={'disabled': True},
html=(
'Currently: <a href="something">something</a>'
'<input type="checkbox" name="myfile-clear" '
'id="myfile-clear_id" disabled>'
'<label for="myfile-clear_id">Clear</label><br>'
'Change: <input type="file" name="myfile" disabled>'
),
)
def test_render_as_subwidget(self):
"""A ClearableFileInput as a subwidget of MultiWidget."""
widget = MultiWidget(widgets=(self.widget,))