mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
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
This commit is contained in:
parent
8ce7beaea0
commit
f2b0f8ea0f
2 changed files with 41 additions and 12 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue