diff options
| author | Vlastimil Zíma <vlastimil.zima@nic.cz> | 2013-10-25 09:13:00 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-08-29 09:40:08 -0400 |
| commit | e622caaa857e74cef4fe7757b6e5b802af814788 (patch) | |
| tree | 6d9bd9afb5a31cfd7489db136bb73bb56d483959 /tests | |
| parent | 045b8d32671f6fc19a4452d6e514d54c37834301 (diff) | |
Fixed #21201 -- Improved customization of ClearableFileInput.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/forms_tests/tests/test_widgets.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/forms_tests/tests/test_widgets.py b/tests/forms_tests/tests/test_widgets.py index 1f19e98389..02048a1fc1 100644 --- a/tests/forms_tests/tests/test_widgets.py +++ b/tests/forms_tests/tests/test_widgets.py @@ -1249,3 +1249,16 @@ class ClearableFileInputTests(TestCase): data={'myfile-clear': True}, files={'myfile': f}, name='myfile'), f) + + def test_render_custom_template(self): + widget = ClearableFileInput() + widget.template_with_initial = ( + '%(initial_text)s: <img src="%(initial_url)s" alt="%(initial)s" /> ' + '%(clear_template)s<br />%(input_text)s: %(input)s' + ) + self.assertHTMLEqual( + widget.render('myfile', FakeFieldFile()), + 'Currently: <img src="something" alt="something" /> ' + '<input type="checkbox" name="myfile-clear" id="myfile-clear_id" /> ' + '<label for="myfile-clear_id">Clear</label><br />Change: <input type="file" name="myfile" />' + ) |
