From 1b00d5f99face282c3d1adb65125541f596881ab Mon Sep 17 00:00:00 2001 From: "Paul (xobb) Chubatyy" Date: Sat, 7 May 2022 22:08:54 -0700 Subject: [PATCH] Add test for the use case --- tests/test_bootstrap_field_radio_select.py | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/test_bootstrap_field_radio_select.py b/tests/test_bootstrap_field_radio_select.py index dc1b0a86..b459414b 100644 --- a/tests/test_bootstrap_field_radio_select.py +++ b/tests/test_bootstrap_field_radio_select.py @@ -22,6 +22,15 @@ class DisabledSelectTestForm(forms.Form): widget=forms.RadioSelect, disabled=True, ) + + +class SelectOtherTestForm(forms.Form): + test = forms.ChoiceField( + choices=( + (1, "one"), + (2, "two"), + ), + widget=forms.RadioSelect(attrs={"form": "another-form"}) class BootstrapFieldSelectTestCase(BootstrapTestCase): @@ -111,3 +120,25 @@ def test_disabled_select(self): "" ), ) + + def test_other_form_select(self): + """Test field with select that belongs to another form widget.""" + self.maxDiff = None + self.assertHTMLEqual( + self.render("{% bootstrap_field form.test %}", context={"form": DisabledSelectTestForm()}), + ( + '
' + '' + '
' + '
' + '' + '' + "
" + '
' + '' + '' + "
" + "
" + "
" + ), + )