[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form/tests -
test_browserwidget.py:1.16 test_radiowidget.py:1.10
test_textareawidget.py:1.9
Sidnei da Silva
sidnei at x3ng.com.br
Sat Aug 16 14:23:44 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/browser/form/tests
In directory cvs.zope.org:/tmp/cvs-serv19336/src/zope/app/browser/form/tests
Modified Files:
test_browserwidget.py test_radiowidget.py
test_textareawidget.py
Log Message:
Make required fields have a required CSS class to help with styling
=== Zope3/src/zope/app/browser/form/tests/test_browserwidget.py 1.15 => 1.16 ===
--- Zope3/src/zope/app/browser/form/tests/test_browserwidget.py:1.15 Wed Aug 13 17:28:04 2003
+++ Zope3/src/zope/app/browser/form/tests/test_browserwidget.py Sat Aug 16 13:23:37 2003
@@ -111,14 +111,23 @@
label = ' '.join(self._widget.label().strip().split())
self.assertEqual(label, '<label for="field.foo">oofay itletay</label>')
- def testRow(self):
+ def testRowRequired(self):
self._widget.request.form.clear()
+ self._widget.context.required = True
label = ''.join(self._widget.label().strip().split())
value = ''.join(self._widget().strip().split())
row = ''.join(self._widget.row().strip().split())
- self.assertEqual(row, '<divclass="label">%s</div>'
+ self.assertEqual(row, '<divclass="labelrequired">%s</div>'
'<divclass="field">%s</div>' % (label, value))
+ def testRowNonRequired(self):
+ self._widget.request.form.clear()
+ self._widget.context.required = False
+ label = ''.join(self._widget.label().strip().split())
+ value = ''.join(self._widget().strip().split())
+ row = ''.join(self._widget.row().strip().split())
+ self.assertEqual(row, '<divclass="label">%s</div>'
+ '<divclass="field">%s</div>' % (label, value))
class TestWidget(BrowserWidget):
=== Zope3/src/zope/app/browser/form/tests/test_radiowidget.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/browser/form/tests/test_radiowidget.py:1.9 Wed Aug 13 17:28:04 2003
+++ Zope3/src/zope/app/browser/form/tests/test_radiowidget.py Sat Aug 16 13:23:37 2003
@@ -88,8 +88,23 @@
label = ' '.join(self._widget.label().strip().split())
self.assertEqual(label, 'oofay itletay')
- def testRow(self):
+ def testRowRequired(self):
self._widget.request.form.clear()
+ self._widget.context.required = True
+ label = ''.join(self._widget.label().strip().split())
+ value = ''.join(self._widget().strip().split())
+ row = ''.join(self._widget.row().strip().split())
+ id = 'field.foo'
+ self.assertEqual(row, '<divclass="labelrequired">'
+ '<labelfor="%s">%s</label>'
+ '</div>'
+ '<divclass="field"id="%s">'
+ '%s'
+ '</div>' % (id, label, id, value))
+
+ def testRowNonRequired(self):
+ self._widget.request.form.clear()
+ self._widget.context.required = False
label = ''.join(self._widget.label().strip().split())
value = ''.join(self._widget().strip().split())
row = ''.join(self._widget.row().strip().split())
=== Zope3/src/zope/app/browser/form/tests/test_textareawidget.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/browser/form/tests/test_textareawidget.py:1.8 Wed Aug 13 17:28:04 2003
+++ Zope3/src/zope/app/browser/form/tests/test_textareawidget.py Sat Aug 16 13:23:37 2003
@@ -45,15 +45,6 @@
'value="Foo Value"')
self.verifyResult(self._widget.hidden(), check_list)
- def testRow(self):
- self._widget.request.form.clear()
- label = ''.join(self._widget.label().strip().split())
- value = ''.join(self._widget().strip().split())
- row = ''.join(self._widget.row().strip().split())
- self.assertEqual(row,
- '<divclass="label">%s</div>'
- '<divclass="field">%s</div>' % (label, value))
-
def test_suite():
return unittest.makeSuite(TextAreaWidgetTest)
More information about the Zope3-Checkins
mailing list