Commit ae39d776 authored by Nicolas Delaby's avatar Nicolas Delaby

Check none checked checkbox

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31074 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2387b8db
...@@ -1202,8 +1202,8 @@ return [] ...@@ -1202,8 +1202,8 @@ return []
if foo_form._getOb(field_name, None) is None: if foo_form._getOb(field_name, None) is None:
foo_form.manage_addField(field_name, 'CheckBox', 'CheckBoxField') foo_form.manage_addField(field_name, 'CheckBox', 'CheckBoxField')
checkbox = getattr(foo_form, field_name) checkbox = getattr(foo_form, field_name)
checkbox.values['default'] = 1
checkbox.values['default'] = 1
odf_document = foo_printout() odf_document = foo_printout()
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -1211,6 +1211,13 @@ return [] ...@@ -1211,6 +1211,13 @@ return []
node = document_tree.xpath('//form:checkbox[@form:name = "%s"]' % field_name, namespaces=document_tree.nsmap)[0] node = document_tree.xpath('//form:checkbox[@form:name = "%s"]' % field_name, namespaces=document_tree.nsmap)[0]
self.assertTrue(node.get('{%s}current-state' % document_tree.nsmap['form'])) self.assertTrue(node.get('{%s}current-state' % document_tree.nsmap['form']))
checkbox.values['default'] = 0
odf_document = foo_printout()
builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml")
document_tree = etree.XML(content_xml)
node = document_tree.xpath('//form:checkbox[@form:name = "%s"]' % field_name, namespaces=document_tree.nsmap)[0]
self.assertFalse(node.get('{%s}current-state' % document_tree.nsmap['form']))
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
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