[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/form/browser/tests/test_textwidget.py TestCase for the rendering of textarea field demonstrating it works with the default display widget

Julien Anguenot ja at nuxeo.com
Mon Jul 25 09:30:39 EDT 2005


Log message for revision 37402:
  TestCase for the rendering of textarea field demonstrating it works with the default display widget

Changed:
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_textwidget.py

-=-
Modified: Zope3/trunk/src/zope/app/form/browser/tests/test_textwidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_textwidget.py	2005-07-25 12:52:55 UTC (rev 37401)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_textwidget.py	2005-07-25 13:30:39 UTC (rev 37402)
@@ -26,6 +26,7 @@
 from zope.app.form.interfaces import IInputWidget
 
 from zope.app.form.browser import TextWidget
+from zope.app.form.browser import TextAreaWidget
 from zope.app.form.browser import DateDisplayWidget
 from zope.app.form.browser import DatetimeDisplayWidget
 from zope.app.form.browser import URIDisplayWidget
@@ -228,7 +229,31 @@
         super(DatetimeDisplayWidgetTest, self).testRenderFull()
         self.verifyResult(self._widget(), ["14:39:01 +000"])
 
+class TextAreaWidgetTest(BrowserWidgetTest):
 
+    _WidgetFactory = TextAreaWidget
+
+    # Rendering with the default DisplayWidget for this widget
+    def testRender(self):
+        value = """
+        texttexttexttexttexttexttexttexttexttexttexttexttexttexttext
+        texttexttexttexttexttexttexttexttexttexttexttexttexttexttext
+        texttexttexttexttexttexttexttexttexttexttexttexttexttexttext
+        """
+        self._widget.setRenderedValue(value)
+        self.assert_(value, self._widget._toFieldValue(value))
+        self.verifyResult(self._widget(), ["<textarea",
+                                           self._widget._toFormValue(value)])
+        check_list = (
+            ('id', 'field.foo'),
+            ('name', 'field.foo'),
+            #('value', ), tested above
+            ('cols', '60'),
+            ('rows', '15'),
+            )
+        for a, v in check_list:
+            self.verifyResult(self._widget(), [a, v])
+
 def test_w_nonrequired_and_missing_value_and_no_inout():
     """
     There was a bug that caused the value attribute to be set to
@@ -280,6 +305,7 @@
         unittest.makeSuite(URIDisplayWidgetTest),
         unittest.makeSuite(DateDisplayWidgetTest),
         unittest.makeSuite(DatetimeDisplayWidgetTest),
+        unittest.makeSuite(TextAreaWidgetTest),
         doctest.DocTestSuite(),
         ))
 



More information about the Zope3-Checkins mailing list