[Zope3-checkins] CVS: Zope3/src/zope/app/form/browser/tests -
test_browserwidget.py:1.4 test_multicheckboxwidget.py:1.5
test_radiowidget.py:1.4 test_sequencewidget.py:1.5
Garrett Smith
garrett at mojave-corp.com
Fri May 7 15:43:57 EDT 2004
Update of /cvs-repository/Zope3/src/zope/app/form/browser/tests
In directory cvs.zope.org:/tmp/cvs-serv32113/src/zope/app/form/browser/tests
Modified Files:
test_browserwidget.py test_multicheckboxwidget.py
test_radiowidget.py test_sequencewidget.py
Log Message:
Updated tests per recent widget changes.
=== Zope3/src/zope/app/form/browser/tests/test_browserwidget.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/form/browser/tests/test_browserwidget.py:1.3 Sat Apr 24 19:19:43 2004
+++ Zope3/src/zope/app/form/browser/tests/test_browserwidget.py Fri May 7 15:43:26 2004
@@ -38,11 +38,11 @@
_FieldFactory = Text
_WidgetFactory = BrowserWidget
- def setUpContent(self, desc=u''):
+ def setUpContent(self, desc=u'', title=u'Foo Title'):
class ITestContent(Interface):
foo = self._FieldFactory(
- title = u"Foo Title",
- description = desc,
+ title=title,
+ description=desc,
)
class TestObject:
implements(ITestContent)
@@ -88,20 +88,12 @@
self.verifyResult(self._widget.hidden(), check_list)
def testLabel(self):
- label = ' '.join(self._widget.label().strip().split())
- self.assertEqual(label, '<label for="field.foo">Foo Title</label>')
+ self.setUpContent(title=u'Foo:')
+ self.assertEqual(self._widget.label, u'Foo:')
- self.setUpContent(desc=u"Foo Description")
- label = ' '.join(self._widget.label().strip().split())
- self.assertEqual(label,
- '<label for="field.foo" title="Foo Description">'
- 'Foo Title</label>'
- )
-
- def testDescription(self):
+ def testHint(self):
self.setUpContent(desc=u'Foo Description')
- description = ' '.join(self._widget.description.strip().split())
- self.assertEqual(description, u'Foo Description')
+ self.assertEqual(self._widget.hint, u'Foo Description')
def testTranslatedLabel(self):
path = os.path.dirname(zope.app.form.browser.tests.__file__)
@@ -110,26 +102,8 @@
domain = TranslationDomain('zope')
domain.addCatalog(catalog)
ztapi.provideUtility(ITranslationDomain, domain, 'zope')
- label = ' '.join(self._widget.label().strip().split())
- self.assertEqual(label, '<label for="field.foo">oofay itletay</label>')
-
- 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="labelrequired">%s</div>'
- '<divclass="field">%s</div>' % (label, value))
+ self.assertEqual(self._widget.label, 'oofay itletay')
- 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/form/browser/tests/test_multicheckboxwidget.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/form/browser/tests/test_multicheckboxwidget.py:1.4 Thu May 6 12:13:41 2004
+++ Zope3/src/zope/app/form/browser/tests/test_multicheckboxwidget.py Fri May 7 15:43:26 2004
@@ -34,10 +34,10 @@
_WidgetFactory = MultiCheckBoxWidget
_FieldFactory = List
- def setUpContent(self, desc=u''):
+ def setUpContent(self, desc=u'', title=u'Foo Title'):
class ITestContent(Interface):
foo = self._FieldFactory(
- title = u'Foo Title',
+ title=title,
description=desc,
value_type=Choice(values=[u'foo', u'bar'])
)
=== Zope3/src/zope/app/form/browser/tests/test_radiowidget.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/form/browser/tests/test_radiowidget.py:1.3 Sat Apr 24 19:19:43 2004
+++ Zope3/src/zope/app/form/browser/tests/test_radiowidget.py Fri May 7 15:43:26 2004
@@ -33,7 +33,7 @@
class RadioWidgetTest(BrowserWidgetTest):
"""Documents and tests the radio widget.
-
+
>>> verifyClass(IInputWidget, RadioWidget)
True
"""
@@ -41,11 +41,11 @@
_FieldFactory = Choice
_WidgetFactory = RadioWidget
- def setUpContent(self, desc=u''):
+ def setUpContent(self, desc=u'', title=u'Foo Title'):
class ITestContent(Interface):
foo = self._FieldFactory(
- title = u"Foo Title",
- description = desc,
+ title=title,
+ description=desc,
values=(u'foo', u'bar')
)
class TestObject:
@@ -101,33 +101,6 @@
self._widget.extra = 'style="color: red"'
self.verifyResult(self._widget.hidden(), check_list)
- def testLabel(self):
- self.assertEqual(self._widget.label(),
- '<label for="field.foo">Foo Title</label>')
-
- def testTranslatedLabel(self):
- path = os.path.dirname(zope.app.form.browser.tests.__file__)
- catalog = GettextMessageCatalog(
- 'pl', 'zope', os.path.join(path, 'testlabeltranslation.mo'))
- domain = TranslationDomain('zope')
- domain.addCatalog(catalog)
- ztapi.provideUtility(ITranslationDomain, domain, 'zope')
- label = ' '.join(self._widget.label().strip().split())
- self.assertEqual(label, '<label for="field.foo">oofay itletay</label>')
-
- def testRowRequired(self):
- self._widget.request.form.clear()
- self._widget.context.required = True
- self.verifyResultMissing(self._widget(),
- ['<input name="field.foo-empty-marker" '
- 'type="hidden" value="1" />\n</div>'])
-
- def testRowNonRequired(self):
- self._widget.request.form.clear()
- self._widget.context.required = False
- self.verifyResult(self._widget(),
- ['<input name="field.foo-empty-marker" '
- 'type="hidden" value="1" />\n</div>'])
def test_suite():
return unittest.TestSuite((
=== Zope3/src/zope/app/form/browser/tests/test_sequencewidget.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/form/browser/tests/test_sequencewidget.py:1.4 Thu May 6 12:13:41 2004
+++ Zope3/src/zope/app/form/browser/tests/test_sequencewidget.py Fri May 7 15:43:26 2004
@@ -41,11 +41,11 @@
True
"""
- def setUpContent(self, desc=u''):
+ def setUpContent(self, desc=u'', title=u'Foo Title'):
class ITestContent(Interface):
foo = self._FieldFactory(
- title = u"Foo Title",
- description = desc,
+ title=title,
+ description=desc,
)
class TestObject:
implements(ITestContent)
More information about the Zope3-Checkins
mailing list