Commit 25d3733f authored by Nicolas Delaby's avatar Nicolas Delaby

Check CheckBoxField

  * render_odt
  * render_odt_view


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32801 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7457f480
...@@ -65,7 +65,7 @@ from Acquisition import aq_base ...@@ -65,7 +65,7 @@ from Acquisition import aq_base
from Products.Formulator.FieldRegistry import FieldRegistry from Products.Formulator.FieldRegistry import FieldRegistry
from Products.Formulator.Validator import ValidationError from Products.Formulator.Validator import ValidationError
from Products.Formulator.StandardFields import FloatField, StringField,\ from Products.Formulator.StandardFields import FloatField, StringField,\
DateTimeField, TextAreaField DateTimeField, TextAreaField, CheckBoxField
from Products.Formulator.MethodField import Method, BoundMethod from Products.Formulator.MethodField import Method, BoundMethod
from Products.Formulator.TALESField import TALESMethod from Products.Formulator.TALESField import TALESMethod
...@@ -310,6 +310,30 @@ class TestTextAreaField(unittest.TestCase): ...@@ -310,6 +310,30 @@ class TestTextAreaField(unittest.TestCase):
.xpath('%s/text:tab' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP) .xpath('%s/text:tab' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)
self.assertTrue(test_value) self.assertTrue(test_value)
class TestCheckBoxField(unittest.TestCase):
"""Tests TextArea field
"""
def getTitle(self):
return "CheckBox Field"
def setUp(self):
self.field = CheckBoxField('test_field')
self.widget = self.field.widget
def test_render_odt(self):
self.field.values['default'] = 1
self.assertEquals('{%s}checkbox' % (NSMAP.get('form')),
self.field.render_odt(as_string=False).tag)
def test_render_odt_view(self):
self.field.values['default'] = 1
request = get_request()
request.set('editable_mode', 0)
self.assertEquals('{%s}p' % (NSMAP.get('text')),
self.field.render_odt(as_string=False, REQUEST=request).tag)
self.assertEquals('1', self.field.render_odt(as_string=False, REQUEST=request).text)
class TestProxyField(PlacelessSetup, unittest.TestCase): class TestProxyField(PlacelessSetup, unittest.TestCase):
def getTitle(self): def getTitle(self):
...@@ -713,6 +737,7 @@ def test_suite(): ...@@ -713,6 +737,7 @@ def test_suite():
suite.addTest(unittest.makeSuite(TestStringField)) suite.addTest(unittest.makeSuite(TestStringField))
suite.addTest(unittest.makeSuite(TestDateTimeField)) suite.addTest(unittest.makeSuite(TestDateTimeField))
suite.addTest(unittest.makeSuite(TestTextAreaField)) suite.addTest(unittest.makeSuite(TestTextAreaField))
suite.addTest(unittest.makeSuite(TestCheckBoxField))
suite.addTest(unittest.makeSuite(TestProxyField)) suite.addTest(unittest.makeSuite(TestProxyField))
suite.addTest(unittest.makeSuite(TestFieldValueCache)) suite.addTest(unittest.makeSuite(TestFieldValueCache))
return suite return suite
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment