[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/tests - test_field_widget.py:1.5
Albertas Agejevas
alga@codeworks.lt
Fri, 21 Feb 2003 09:54:04 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/services/tests
In directory cvs.zope.org:/tmp/cvs-serv25770/app/browser/services/tests
Modified Files:
test_field_widget.py
Log Message:
Changed the browser:editform to clear the values which are missing or
empty in the form by default.
Added a keyword argument set_missing to getWidgetsData() and
getWidgetsDataForContent().
Renamed a keyword argument required there to strict, which is
clearer. Added it everywhere to be more explicit.
=== Zope3/src/zope/app/browser/services/tests/test_field_widget.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/services/tests/test_field_widget.py:1.4 Sun Jan 12 16:22:16 2003
+++ Zope3/src/zope/app/browser/services/tests/test_field_widget.py Fri Feb 21 09:53:33 2003
@@ -108,6 +108,23 @@
self.assertEqual(widget._convert(u''), None)
self.assertEqual(widget._convert(u'/a'), u'/a')
+ def test_haveData(self):
+
+ # Empty string means we don't have data
+ fake = FakeComponentPath(None, I1)
+ self.request.form['field.X'] = ''
+ widget = self.createWidget(fake, self.request)
+ self.failIf(widget.haveData())
+
+ self.request.form['field.X'] = '/foo'
+ widget = self.createWidget(fake, self.request)
+ self.failUnless(widget.haveData())
+
+ self.request.form['field.X'] = None
+ widget = self.createWidget(fake, self.request)
+ self.failIf(widget.haveData())
+
+
class TestComponentLocationWidget(BaseTest):
def createWidget(self, field, request):