diff options
| author | Carles Pina <carles@pina.cat> | 2020-05-04 17:41:38 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-06-01 12:48:26 +0200 |
| commit | 56af541790a7acf23fe5c911a4e04969ddac1dc6 (patch) | |
| tree | ac584e9f642c7bad79e8a5e1772c775c6765a642 /tests/admin_widgets/tests.py | |
| parent | 22dac456f34f273b61aa434820c426c9620e28c9 (diff) | |
[3.1.x] Fixed #31536 -- Fixed rendering of disabled AdminFileWidget and ClearableFileInput.
Backport of e46c2326c8cfc038e015f55fd050ab5d7eb91b62 from master
Diffstat (limited to 'tests/admin_widgets/tests.py')
| -rw-r--r-- | tests/admin_widgets/tests.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index 7241ea9554..b60d01e43f 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -487,6 +487,20 @@ class AdminFileWidgetTests(TestDataMixin, TestCase): }, ) + def test_render_disabled(self): + widget = widgets.AdminFileWidget(attrs={'disabled': True}) + self.assertHTMLEqual( + widget.render('test', self.album.cover_art), + '<p class="file-upload">Currently: <a href="%(STORAGE_URL)salbums/' + r'hybrid_theory.jpg">albums\hybrid_theory.jpg</a> ' + '<span class="clearable-file-input">' + '<input type="checkbox" name="test-clear" id="test-clear_id" disabled>' + '<label for="test-clear_id">Clear</label></span><br>' + 'Change: <input type="file" name="test" disabled></p>' % { + 'STORAGE_URL': default_storage.url(''), + }, + ) + def test_readonly_fields(self): """ File widgets should render as a link when they're marked "read only." |
