[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form/tests - test_browserwidget.py:1.14 test_objectwidget.py:1.2

Stuart Bishop zen@shangri-la.dropbear.id.au
Tue, 15 Jul 2003 12:08:57 -0400


Update of /cvs-repository/Zope3/src/zope/app/browser/form/tests
In directory cvs.zope.org:/tmp/cvs-serv12287/src/zope/app/browser/form/tests

Modified Files:
	test_browserwidget.py test_objectwidget.py 
Log Message:
Fix up Widget subclasses that redefined row() and/or label() to
output error codes and descriptions.


=== Zope3/src/zope/app/browser/form/tests/test_browserwidget.py 1.13 => 1.14 ===
--- Zope3/src/zope/app/browser/form/tests/test_browserwidget.py:1.13	Sun Jul 13 02:47:18 2003
+++ Zope3/src/zope/app/browser/form/tests/test_browserwidget.py	Tue Jul 15 12:08:51 2003
@@ -37,9 +37,12 @@
     _FieldFactory = Text
     _WidgetFactory = BrowserWidget
 
-    def setUpContent(self):
+    def setUpContent(self, desc=u''):
         class ITestContent(Interface):
-            foo = self._FieldFactory(title = u"Foo Title")
+            foo = self._FieldFactory(
+                    title = u"Foo Title",
+                    description = desc,
+                    )
         class TestObject:
             implements(ITestContent)
 
@@ -85,6 +88,18 @@
     def testLabel(self):
         label = ' '.join(self._widget.label().strip().split())
         self.assertEqual(label, '<label for="field.foo">Foo Title</label>')
+
+        self.setUpContent(desc=u"Foo Description")
+        label = ' '.join(self._widget.label().strip().split())
+        self.assertEqual(label,
+                '<label for="field.foo">'
+                '<acronym title="Foo Description">Foo Title</acronym></label>'
+                )
+
+    def testDescription(self):
+        self.setUpContent(desc=u'Foo Description')
+        description = ' '.join(self._widget.description.strip().split())
+        self.assertEqual(description, u'Foo Description')
 
     def testTranslatedLabel(self):
         path = os.path.dirname(zope.app.browser.form.tests.__file__)


=== Zope3/src/zope/app/browser/form/tests/test_objectwidget.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/browser/form/tests/test_objectwidget.py:1.1	Sun Jul 13 02:47:18 2003
+++ Zope3/src/zope/app/browser/form/tests/test_objectwidget.py	Tue Jul 15 12:08:51 2003
@@ -40,11 +40,15 @@
         kw.update({'factory': TestContact})
         return ObjectWidget(context, request, **kw)
 
-    def setUpContent(self):
+    def setUpContent(self, desc=u''):
         provideView(ITextLine, 'edit', IBrowserPresentation, [TextWidget])
 
         class ITestContent(Interface):
-            foo = self._FieldFactory(ITestContact, title = u"Foo Title")
+            foo = self._FieldFactory(
+                    ITestContact, 
+                    title = u"Foo Title",
+                    description = desc
+                    )
         class TestObject:
             implements(ITestContent)