[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/form/browser/
Updated RadioWidget to add <label> elements around <input
type="radio" ...>
Marius Gedminas
marius at pov.lt
Tue Jul 27 10:30:32 EDT 2004
Log message for revision 26791:
Updated RadioWidget to add <label> elements around <input type="radio" ...>
and the label.
Changed:
U Zope3/trunk/src/zope/app/form/browser/itemswidgets.py
U Zope3/trunk/src/zope/app/form/browser/tests/test_itemswidget.py
-=-
Modified: Zope3/trunk/src/zope/app/form/browser/itemswidgets.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/itemswidgets.py 2004-07-27 14:22:26 UTC (rev 26790)
+++ Zope3/trunk/src/zope/app/form/browser/itemswidgets.py 2004-07-27 14:30:31 UTC (rev 26791)
@@ -472,7 +472,7 @@
_messageNoValue = message(_("vocabulary-missing-single-value-for-edit"),
"(no value)")
- _joinButtonToMessageTemplate = u"%s %s"
+ _joinButtonToMessageTemplate = u"<label>%s %s</label>"
def renderItem(self, index, text, value, name, cssClass):
"""Render an item of the list."""
Modified: Zope3/trunk/src/zope/app/form/browser/tests/test_itemswidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_itemswidget.py 2004-07-27 14:22:26 UTC (rev 26790)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_itemswidget.py 2004-07-27 14:30:31 UTC (rev 26791)
@@ -283,7 +283,7 @@
widget = self._makeWidget()
self.verifyResult(
widget.renderItem('', 'Foo', 'foo', 'bar', None),
- ['<input', 'type="radio"', 'name="bar"', 'value="foo"',
+ ['<label', '<input', 'type="radio"', 'name="bar"', 'value="foo"',
'class="radioType"', '> Foo'])
self.verifyResult(
widget.renderItem('bar', 'Foo', 'foo', 'bar', 'klass'),
@@ -294,11 +294,11 @@
widget = self._makeWidget()
self.verifyResult(
widget.renderSelectedItem('', 'Foo', 'foo', 'bar', 'klass'),
- ['<input', 'type="radio"', 'name="bar"', 'value="foo"',
+ ['<label', '<input', 'type="radio"', 'name="bar"', 'value="foo"',
'checked="checked"', '> Foo'])
self.verifyResult(
widget.renderSelectedItem('', 'Foo', 'foo', 'bar', 'klass'),
- ['<input', 'type="radio"', 'name="bar"', 'value="foo"',
+ ['<label', '<input', 'type="radio"', 'name="bar"', 'value="foo"',
'class="klass radioType"', 'checked="checked"', '> Foo'])
def test_renderItemsWithValues(self):
@@ -309,7 +309,7 @@
index = items.index(item)
self.verifyResult(
item,
- ['<input', 'class="radioType"', 'name="field.choice"',
+ ['<label', '<input', 'class="radioType"', 'name="field.choice"',
'id="field.choice.%i' %index, 'type="radio"',
'value="%s"' %values[index], ' %s' %values[index]])
self.verifyResult(items[0], ['checked="checked"'])
@@ -322,7 +322,7 @@
index = items.index(item)
self.verifyResult(
item,
- ['<input', 'class="radioType"', 'name="field.choice"',
+ ['<label', '<input', 'class="radioType"', 'name="field.choice"',
'id="field.choice.%i' %index, 'type="radio"',
'value="%s"' %values[index], ' %s' %values[index]])
self.verifyResult(items[0], ['checked="checked"'])
@@ -336,7 +336,7 @@
index = items.index(item)
self.verifyResult(
item,
- ['<input', 'class="radioType"', 'name="field.choice"',
+ ['<label', '<input', 'class="radioType"', 'name="field.choice"',
'type="radio"', ' %s' %values[index]])
def test_renderItems_firstItem(self):
@@ -348,16 +348,17 @@
index = items.index(item)
self.verifyResult(
item,
- ['<input', 'class="radioType"', 'name="field.choice"',
+ ['<label', '<input', 'class="radioType"', 'name="field.choice"',
'id="field.choice.%i"' %index, 'type="radio"',
' %s' %values[index]])
self.verifyResult(items[0], ['checked="checked"'])
def test_renderValue(self):
widget = self._makeWidget()
- self.verifyResult(widget.renderValue(None), ['<br /><input'])
- widget.orientation='horizontal'
- self.verifyResult(widget.renderValue(None), [' <input'])
+ self.verifyResult(widget.renderValue(None), ['<br /><label><input'])
+ widget.orientation = 'horizontal'
+ self.verifyResult(widget.renderValue(None),
+ [' <label><input'])
class ItemsMultiEditWidgetBaseTest(ItemsEditWidgetBaseTest):
More information about the Zope3-Checkins
mailing list