Commit b3997745 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added test to check the support for editable list fields in Listbox

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9330 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ad079902
......@@ -216,8 +216,8 @@ return []
"""
portal = self.getPortal()
portal.ListBoxZuite_reset()
# We create a script to use as a list method
# We create a script to use as a list method
list_method_id = 'ListBox_ParametersListMethod'
createZODBPythonScript(
portal.portal_skins.custom,
......@@ -259,6 +259,42 @@ return []
except TypeError, e:
self.fail('Unable to commit transaction: %s' % e)
def test_06_LineFields(self, quiet=0, run=run_all_test):
"""
Line Fields are able to render a list parameter in the form
of lines. The same behaviour is expected for Line Fields used
in ListBox objects.
"""
portal = self.getPortal()
portal.ListBoxZuite_reset()
# Reset listbox properties
listbox = portal.FooModule_viewFooList.listbox
listbox.ListBox_setPropertyList(
field_list_method = 'portal_catalog',
field_columns = ['subject_list | Subjects',],
field_editable_columns = ['subject_list | Subjects',],
)
# Create an new empty object with a list property
foo_module = portal.foo_module
word = 'averycomplexwordwhichhaslittlechancetoexistinhtml'
o = foo_module.newContent(subject_list = [word])
# Make sure that word is the subject list
self.assertEqual(word in o.getSubjectList(), True)
# Reindex
o.immediateReindexObject()
# Render the module in html
request = get_request()
request['here'] = portal.foo_module
rendered_listbox = listbox.render(REQUEST=request)
# Make sure that word is there
self.assertEqual(rendered_listbox.find(word) > 0, True)
if __name__ == '__main__':
framework()
else:
......
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