[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Forms/Views/Browser/tests - testBrowserWidget.py:1.6.8.1
Jim Fulton
jim@zope.com
Thu, 12 Dec 2002 10:16:50 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Forms/Views/Browser/tests
In directory cvs.zope.org:/tmp/cvs-serv21998/Views/Browser/tests
Modified Files:
Tag: AdapterAndView-branch
testBrowserWidget.py
Log Message:
Changed the widget haveData method to run the conversion api to make
sure that there is non-missing data, not just form data.
=== Zope3/lib/python/Zope/App/Forms/Views/Browser/tests/testBrowserWidget.py 1.6 => 1.6.8.1 ===
--- Zope3/lib/python/Zope/App/Forms/Views/Browser/tests/testBrowserWidget.py:1.6 Wed Dec 4 04:58:46 2002
+++ Zope3/lib/python/Zope/App/Forms/Views/Browser/tests/testBrowserWidget.py Thu Dec 12 10:16:50 2002
@@ -73,8 +73,15 @@
row = ''.join(self._widget.row().strip().split())
self.assertEqual(row, '<td>%s</td><td>%s</td>' % (label, value))
+class TestWidget(BrowserWidget):
+
+ def _convert(self, v):
+ return v or None
+
class Test(BrowserWidgetTest):
+ _WidgetFactory = TestWidget
+
def test_showData(self):
class W(BrowserWidget):
@@ -94,6 +101,13 @@
w.setData('Xfoo')
self.assertEqual(w._showData(), 'foo')
+
+ def test_haveData(self):
+ self.failUnless(self._widget.haveData())
+ del self._widget.request.form['field.foo']
+ self.failIf(self._widget.haveData())
+ self._widget.request.form['field.foo'] = u''
+ self.failIf(self._widget.haveData())
def test_suite():
return unittest.makeSuite(Test)