Commit c50af870 authored by Nicolas Dumazet's avatar Nicolas Dumazet

add test for bug #1443


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34350 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0781683f
...@@ -42,6 +42,7 @@ from ZPublisher.HTTPRequest import FileUpload ...@@ -42,6 +42,7 @@ from ZPublisher.HTTPRequest import FileUpload
from StringIO import StringIO from StringIO import StringIO
from Products.ERP5Form.Selection import Selection from Products.ERP5Form.Selection import Selection
from Products.ERP5Form.Form import ERP5Form from Products.ERP5Form.Form import ERP5Form
from Products.Formulator.TALESField import TALESMethod
class DummyFieldStorage: class DummyFieldStorage:
...@@ -297,6 +298,45 @@ return [] ...@@ -297,6 +298,45 @@ return []
# Make sure that word is there # Make sure that word is there
self.assertEqual(rendered_listbox.find(word) > 0, True) self.assertEqual(rendered_listbox.find(word) > 0, True)
def testCellKeywordInProxifiedListboxColumn(self):
"""
Test that cell keyword is correctly interpreted when used in TALES
to render a cell of a ListBox.
First use cell in the ProxyField context, then use it in the listbox_xxx
context
"""
portal = self.getPortal()
portal.ListBoxZuite_reset()
form = portal.Foo_viewListBoxProxyField
portal.foo_module.FooModule_createObjects()
here = portal.foo_module['0']
here.Foo_createObjects()
request = get_request()
request['here'] = here
transaction.commit()
listbox_title_column = form.listbox_title
self.assertTrue(listbox_title_column.is_delegated('default'))
self.assertEquals(listbox_title_column.get_recursive_tales('default')._text,
'python: cell.getTitle()')
listboxline_list = form.listbox.get_value('default', render_format = 'list',
REQUEST = request)
first_item = dict(listboxline_list[1].getColumnItemList())
self.assertEquals(first_item['title'], 'Title 0')
# Use "cell" locally
listbox_title_column.manage_tales_surcharged_xmlrpc(
dict(default=TALESMethod('python: cell.getTitle() + " local"')))
listboxline_list = form.listbox.get_value('default', render_format = 'list',
REQUEST = request)
first_item = dict(listboxline_list[1].getColumnItemList())
self.assertEquals(first_item['title'], 'Title 0 local')
def _helperExtraAndCssInListboxLine(self, field_type, editable): def _helperExtraAndCssInListboxLine(self, field_type, editable):
""" """
Create a listbox_xxx field, in the hidden group, that defines Create a listbox_xxx field, in the hidden group, that defines
......
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