Describe the bug
The GovCheckboxInput widget assumes that a fieldset is never used for a single checkbox. This can be useful for confirmation questions, e.g.:
Are these answers correct?
[x] I confirm that all answers are correct
To Reproduce
>>> from wtforms import BooleanField, Form
>>> from govuk_frontend_wtf.wtforms_widgets import GovCheckboxInput
>>> class MyForm(Form):
... boolean = BooleanField(widget=GovCheckboxInput())
>>> form = MyForm()
>>> form.boolean.widget.map_gov_params(form.boolean, params={"fieldset": {"legend": {"text": "mylegend"}}}, items=[])
{'name': 'boolean', 'items': [], 'hint': {'text': ''}}
Expected behavior
I would expected the supplied fieldset to be preserved:
Describe the bug The
GovCheckboxInput
widget assumes that a fieldset is never used for a single checkbox. This can be useful for confirmation questions, e.g.:To Reproduce
Expected behavior I would expected the supplied fieldset to be preserved:
This behaviour is due to GovCheckboxInput trying to remove the default fieldset added by its superclass,
GovCheckboxesInput
.