summaryrefslogtreecommitdiff
path: root/tests/forms_tests
diff options
context:
space:
mode:
authorDavid Smith <smithdc@gmail.com>2024-04-29 08:13:35 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-04-30 11:11:02 +0200
commitc187f5f9242b681abaa199173e02066997439425 (patch)
tree08651d3d2a3906c481483efb98c80274960b22e8 /tests/forms_tests
parent85c154da2f07485a1cdc4d886eee4c1a1ef56137 (diff)
Refs #32819 -- Avoided adding 'aria-describedby' to hidden inputs.
Hidden elements are not visible for both accessibility tools and browsers presentation layer. This change therefore only reduces the size of the generated HTML.
Diffstat (limited to 'tests/forms_tests')
-rw-r--r--tests/forms_tests/tests/test_forms.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py
index a86d443e33..3982cc93fe 100644
--- a/tests/forms_tests/tests/test_forms.py
+++ b/tests/forms_tests/tests/test_forms.py
@@ -2136,6 +2136,15 @@ class FormsTestCase(SimpleTestCase):
p.as_p(), '<input type="hidden" name="foo"><input type="hidden" name="bar">'
)
+ def test_hidden_widget_does_not_have_aria_describedby(self):
+ class TestForm(Form):
+ hidden_text = CharField(widget=HiddenInput, help_text="Help Text")
+
+ f = TestForm()
+ self.assertEqual(
+ str(f), '<input type="hidden" name="hidden_text" id="id_hidden_text">'
+ )
+
def test_field_order(self):
# A Form's fields are displayed in the same order in which they were defined.
class TestForm(Form):