summaryrefslogtreecommitdiff
path: root/tests/regressiontests/forms
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2011-02-05 18:16:27 +0000
committerRamiro Morales <cramm0@gmail.com>2011-02-05 18:16:27 +0000
commitf2b0f8ea0fc5849801a2aeb71f2db106e5655aea (patch)
tree43c5a14fdbcd5e2a348e08f410746f8154448c25 /tests/regressiontests/forms
parent8ce7beaea05cff2ba6cda6ad6747e8840291ff06 (diff)
Fixed #15226 - Made SelectDateWidget render the label tag associated with the correct dropdown sub-widget when USE_L10N is active and non-English locale is in use.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15427 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/forms')
-rw-r--r--tests/regressiontests/forms/tests/extra.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/tests/extra.py b/tests/regressiontests/forms/tests/extra.py
index 787a129338..927362a71f 100644
--- a/tests/regressiontests/forms/tests/extra.py
+++ b/tests/regressiontests/forms/tests/extra.py
@@ -356,6 +356,10 @@ class FormsExtraTestCase(unittest.TestCase, AssertFormErrorsMixin):
self.assertFalse(c.is_valid())
self.assertEqual(c.errors, {'mydate': [u'Enter a valid date.']})
+ # label tag is correctly associated with month dropdown
+ d = GetDate({'mydate_month':'1', 'mydate_day':'1', 'mydate_year':'2010'})
+ self.assertTrue('<label for="id_mydate_month">' in d.as_p())
+
def test_multiwidget(self):
# MultiWidget and MultiValueField #############################################
# MultiWidgets are widgets composed of other widgets. They are usually
@@ -616,3 +620,8 @@ class FormsExtraL10NTestCase(unittest.TestCase):
self.assertFalse(a.is_valid())
# 'Geef een geldige datum op.' = 'Enter a valid date.'
self.assertEqual(a.errors, {'mydate': [u'Geef een geldige datum op.']})
+
+ def test_form_label_association(self):
+ # label tag is correctly associated with first rendered dropdown
+ a = GetDate({'mydate_month':'1', 'mydate_day':'1', 'mydate_year':'2010'})
+ self.assertTrue('<label for="id_mydate_day">' in a.as_p())