[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form/tests - test_checkboxwidget.py:1.7 test_filewidget.py:1.5 test_listwidget.py:1.6 test_multicheckboxwidget.py:1.6 test_multilistwidget.py:1.6 test_passwordwidget.py:1.6 test_radiowidget.py:1.7 test_textareawidget.py:1.6 test_textwidget.py:1.5 test_vocabularywidget.py:1.4
Jim Fulton
jim@zope.com
Thu, 22 May 2003 18:50:40 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/form/tests
In directory cvs.zope.org:/tmp/cvs-serv12744/src/zope/app/browser/form/tests
Modified Files:
test_checkboxwidget.py test_filewidget.py test_listwidget.py
test_multicheckboxwidget.py test_multilistwidget.py
test_passwordwidget.py test_radiowidget.py
test_textareawidget.py test_textwidget.py
test_vocabularywidget.py
Log Message:
Deprecated the browser widget render and renderHidden methods.
=== Zope3/src/zope/app/browser/form/tests/test_checkboxwidget.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/browser/form/tests/test_checkboxwidget.py:1.6 Tue Apr 8 17:34:22 2003
+++ Zope3/src/zope/app/browser/form/tests/test_checkboxwidget.py Thu May 22 18:50:09 2003
@@ -36,23 +36,19 @@
def testRender(self):
value = 1
+ self._widget.setData(value)
check_list = ('type="checkbox"', 'id="field.foo"',
'name="field.foo"', 'checked="checked"')
- self._verifyResult(self._widget.render(value), check_list)
+ self._verifyResult(self._widget(), check_list)
value = 0
+ self._widget.setData(value)
check_list = check_list[:-1]
- self._verifyResult(self._widget.render(value), check_list)
+ self._verifyResult(self._widget(), check_list)
check_list = ('type="hidden"',) + check_list[1:-1]
- self._verifyResult(self._widget.renderHidden(value), check_list)
+ self._verifyResult(self._widget.hidden(), check_list)
check_list = ('style="color: red"',) + check_list
self._widget.extra = 'style="color: red"'
- self._verifyResult(self._widget.renderHidden(value), check_list)
-
- def test_haveData(self):
- # Checkbox always has data
- self.failUnless(self._widget.haveData())
- del self._widget.request.form['field.foo']
- self.failUnless(self._widget.haveData())
+ self._verifyResult(self._widget.hidden(), check_list)
def test_getData(self):
self._widget.request.form['field.foo'] = 'on'
=== Zope3/src/zope/app/browser/form/tests/test_filewidget.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/form/tests/test_filewidget.py:1.4 Tue Apr 8 17:34:22 2003
+++ Zope3/src/zope/app/browser/form/tests/test_filewidget.py Thu May 22 18:50:09 2003
@@ -43,14 +43,16 @@
def testRender(self):
value = 'Foo Value'
+ self._widget.setData(value)
check_list = ('type="file"', 'id="field.foo"', 'name="field.foo"',
'size="20"')
- self._verifyResult(self._widget.render(value), check_list)
+
+ self._verifyResult(self._widget(), check_list)
check_list = ('type="hidden"',) + check_list[1:-1]
- self._verifyResult(self._widget.renderHidden(value), check_list)
+ self._verifyResult(self._widget.hidden(), check_list)
check_list = ('style="color: red"',) + check_list
self._widget.extra = 'style="color: red"'
- self._verifyResult(self._widget.renderHidden(value), check_list)
+ self._verifyResult(self._widget.hidden(), check_list)
=== Zope3/src/zope/app/browser/form/tests/test_listwidget.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/form/tests/test_listwidget.py:1.5 Tue Apr 8 17:34:22 2003
+++ Zope3/src/zope/app/browser/form/tests/test_listwidget.py Thu May 22 18:50:09 2003
@@ -58,14 +58,15 @@
check_list = ('select', 'id="field.foo"', 'name="field.foo"',
'size="5"', 'option', 'value="foo"', '>foo<',
'value="foo"', '>bar<', 'selected="selected"')
- self._verifyResult(self._widget.render(value), check_list)
+ self._widget.setData(value)
+ self._verifyResult(self._widget(), check_list)
check_list = ('type="hidden"', 'id="field.foo"', 'name="field.foo"',
'value="foo"')
- self._verifyResult(self._widget.renderHidden(value), check_list)
+ self._verifyResult(self._widget.hidden(), check_list)
check_list = ('style="color: red"',) + check_list
self._widget.extra = 'style="color: red"'
- self._verifyResult(self._widget.renderHidden(value), check_list)
+ self._verifyResult(self._widget.hidden(), check_list)
=== Zope3/src/zope/app/browser/form/tests/test_multicheckboxwidget.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/form/tests/test_multicheckboxwidget.py:1.5 Tue Apr 8 17:34:22 2003
+++ Zope3/src/zope/app/browser/form/tests/test_multicheckboxwidget.py Thu May 22 18:50:09 2003
@@ -56,17 +56,18 @@
def testRender(self):
value = 'bar'
+ self._widget.setData(value)
check_list = ('type="checkbox"', 'id="field.foo"',
'name="field.foo"', 'value="bar"', 'bar',
'value="foo"', 'foo', 'checked="checked"')
- self._verifyResult(self._widget.render(value), check_list)
+ self._verifyResult(self._widget(), check_list)
check_list = ('type="hidden"', 'id="field.foo"', 'name="field.foo"',
'value="bar"')
- self._verifyResult(self._widget.renderHidden(value), check_list)
+ self._verifyResult(self._widget.hidden(), check_list)
check_list = ('style="color: red"',) + check_list
self._widget.extra = 'style="color: red"'
- self._verifyResult(self._widget.renderHidden(value), check_list)
+ self._verifyResult(self._widget.hidden(), check_list)
def test_suite():
=== Zope3/src/zope/app/browser/form/tests/test_multilistwidget.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/form/tests/test_multilistwidget.py:1.5 Tue Apr 8 17:34:22 2003
+++ Zope3/src/zope/app/browser/form/tests/test_multilistwidget.py Thu May 22 18:50:09 2003
@@ -53,18 +53,19 @@
def testRender(self):
value = 'foo'
+ self._widget.setData(value)
check_list = ('select', 'id="field.foo"', 'name="field.foo"',
'size="5"', 'option', 'value="foo"', '>foo<',
'value="foo"', '>bar<', 'selected="selected"',
'multiple="multiple"')
- self._verifyResult(self._widget.render(value), check_list)
+ self._verifyResult(self._widget(), check_list)
check_list = ('type="hidden"', 'id="field.foo"', 'name="field.foo"',
'value="foo"')
- self._verifyResult(self._widget.renderHidden(value), check_list)
+ self._verifyResult(self._widget.hidden(), check_list)
check_list = ('style="color: red"',) + check_list
self._widget.extra = 'style="color: red"'
- self._verifyResult(self._widget.renderHidden(value), check_list)
+ self._verifyResult(self._widget.hidden(), check_list)
=== Zope3/src/zope/app/browser/form/tests/test_passwordwidget.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/form/tests/test_passwordwidget.py:1.5 Tue Apr 8 17:34:22 2003
+++ Zope3/src/zope/app/browser/form/tests/test_passwordwidget.py Thu May 22 18:50:09 2003
@@ -35,9 +35,10 @@
def testRender(self):
value = 'Foo Value'
+ self._widget.setData(value)
check_list = ('type="password"', 'id="field.foo"',
'name="field.foo"', 'value=""', 'size="20"')
- self._verifyResult(self._widget.render(value), check_list)
+ self._verifyResult(self._widget(), check_list)
def testHidden(self):
self.assertRaises(NotImplementedError, self._widget.hidden)
=== Zope3/src/zope/app/browser/form/tests/test_radiowidget.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/browser/form/tests/test_radiowidget.py:1.6 Tue Apr 8 17:34:22 2003
+++ Zope3/src/zope/app/browser/form/tests/test_radiowidget.py Thu May 22 18:50:09 2003
@@ -57,17 +57,18 @@
def testRender(self):
value = 'bar'
+ self._widget.setData(value)
check_list = ('type="radio"', 'id="field.foo.0"',
'name="field.foo"', 'value="bar"', 'bar',
'value="foo"', 'foo', 'checked="checked"')
- self._verifyResult(self._widget.render(value), check_list)
+ self._verifyResult(self._widget(), check_list)
check_list = ('type="hidden"', 'id="field.foo"',
'name="field.foo"', 'value="bar"')
- self._verifyResult(self._widget.renderHidden(value), check_list)
+ self._verifyResult(self._widget.hidden(), check_list)
check_list = ('style="color: red"',) + check_list
self._widget.extra = 'style="color: red"'
- self._verifyResult(self._widget.renderHidden(value), check_list)
+ self._verifyResult(self._widget.hidden(), check_list)
def testLabel(self):
label = ' '.join(self._widget.label().strip().split())
=== Zope3/src/zope/app/browser/form/tests/test_textareawidget.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/form/tests/test_textareawidget.py:1.5 Tue Apr 8 17:34:22 2003
+++ Zope3/src/zope/app/browser/form/tests/test_textareawidget.py Thu May 22 18:50:09 2003
@@ -34,15 +34,16 @@
def testRender(self):
value = "Foo Value"
+ self._widget.setData(value)
check_list = ('rows="15"', 'cols="60"', 'id="field.foo"',
'name="field.foo"', 'textarea')
- self._verifyResult(self._widget.render(value), check_list)
+ self._verifyResult(self._widget(), check_list)
check_list = ('style="color: red"',) + check_list
self._widget.extra = 'style="color: red"'
- self._verifyResult(self._widget.render(value), check_list)
+ self._verifyResult(self._widget(), check_list)
check_list = ('type="hidden"', 'id="field.foo"', 'name="field.foo"',
'value="Foo Value"')
- self._verifyResult(self._widget.renderHidden(value), check_list)
+ self._verifyResult(self._widget.hidden(), check_list)
def testRow(self):
self._widget.request.form.clear()
=== Zope3/src/zope/app/browser/form/tests/test_textwidget.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/form/tests/test_textwidget.py:1.4 Tue Apr 8 16:02:14 2003
+++ Zope3/src/zope/app/browser/form/tests/test_textwidget.py Thu May 22 18:50:09 2003
@@ -35,14 +35,15 @@
def testRender(self):
value = 'Foo Value'
+ self._widget.setData(value)
check_list = ('type="text"', 'id="field.foo"', 'name="field.foo"',
'value="Foo Value"', 'size="20"')
- self._verifyResult(self._widget.render(value), check_list)
+ self._verifyResult(self._widget(), check_list)
check_list = ('type="hidden"',) + check_list[1:-1]
- self._verifyResult(self._widget.renderHidden(value), check_list)
+ self._verifyResult(self._widget.hidden(), check_list)
check_list = ('style="color: red"',) + check_list
self._widget.extra = 'style="color: red"'
- self._verifyResult(self._widget.renderHidden(value), check_list)
+ self._verifyResult(self._widget.hidden(), check_list)
=== Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py:1.3 Wed May 21 20:39:33 2003
+++ Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py Thu May 22 18:50:09 2003
@@ -90,7 +90,7 @@
"""
__implements__ = IBrowserWidget
- def render(self, value):
+ def __call__(self):
return "foo"