diff options
author | Peter Andersen <peter@porksmash.com> | 2019-12-09 08:54:40 -0800 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-12-10 12:27:50 +0100 |
commit | 02eff7ef60466da108b1a33f1e4dc01eec45c99d (patch) | |
tree | 95064bbf996ab878b2217b693c58a734abad5385 /tests/postgres_tests/test_array.py | |
parent | 3fb7c12158a2402f0f80824f6778112071235803 (diff) | |
download | django-02eff7ef60466da108b1a33f1e4dc01eec45c99d.tar.gz |
Fixed #31073 -- Prevented CheckboxInput.get_context() from mutating attrs.
Diffstat (limited to 'tests/postgres_tests/test_array.py')
-rw-r--r-- | tests/postgres_tests/test_array.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index 481d93f830..ee66fbcd60 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -1103,6 +1103,17 @@ class TestSplitFormWidget(PostgreSQLWidgetTestCase): } ) + def test_checkbox_get_context_attrs(self): + context = SplitArrayWidget( + forms.CheckboxInput(), + size=2, + ).get_context('name', [True, False]) + self.assertEqual(context['widget']['value'], '[True, False]') + self.assertEqual( + [subwidget['attrs'] for subwidget in context['widget']['subwidgets']], + [{'checked': True}, {}] + ) + def test_render(self): self.check_html( SplitArrayWidget(forms.TextInput(), size=2), 'array', None, |