diff options
| author | Peter Andersen <peter@porksmash.com> | 2019-12-09 08:54:40 -0800 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-12-11 09:38:49 +0100 |
| commit | f33be1e8ae2efbca5f209e2365fa35c2aaee340c (patch) | |
| tree | ddfba23bf5a4e53d0b6f255b8d84ee95ca14bfff /tests/postgres_tests/test_array.py | |
| parent | e8b0903976077b951795938b260211214ed7fe41 (diff) | |
[2.2.x] Fixed #31073 -- Prevented CheckboxInput.get_context() from mutating attrs.
Backport of 02eff7ef60466da108b1a33f1e4dc01eec45c99d from master
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 447d511c9f..021c58b6fd 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -917,6 +917,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, |
