summaryrefslogtreecommitdiff
path: root/tests/forms_tests
diff options
context:
space:
mode:
authorSage Abdullah <me@laymonage.com>2023-07-11 13:50:56 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-07-12 05:43:41 +0200
commit3f73df44f2726319f6af44c5613e5e531e9370b6 (patch)
tree7364de35905c228738b2c4fac376c0d4524359b4 /tests/forms_tests
parente5e9699e0fe1e7affe3c68082ed1e205726a4c79 (diff)
Fixed #34705 -- Reallowed BoundField.as_widget()'s attrs argument to set aria-describedby.
Regression in 966ecdd482167f3f6b08b00f484936c837751cb9.
Diffstat (limited to 'tests/forms_tests')
-rw-r--r--tests/forms_tests/tests/test_forms.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py
index 99a38eedcb..0baddad69b 100644
--- a/tests/forms_tests/tests/test_forms.py
+++ b/tests/forms_tests/tests/test_forms.py
@@ -3082,6 +3082,17 @@ Options: <select multiple name="options" required>
"</span></td></tr>",
)
+ def test_as_widget_custom_aria_describedby(self):
+ class FoodForm(Form):
+ intl_name = CharField(help_text="The food's international name.")
+
+ form = FoodForm({"intl_name": "Rendang"})
+ self.assertHTMLEqual(
+ form["intl_name"].as_widget(attrs={"aria-describedby": "some_custom_id"}),
+ '<input type="text" name="intl_name" value="Rendang"'
+ 'aria-describedby="some_custom_id" required id="id_intl_name">',
+ )
+
def test_subclassing_forms(self):
# You can subclass a Form to add fields. The resulting form subclass will have
# all of the fields of the parent Form, plus whichever fields you define in the