def test_table_form(): """Base tests : values and behavior. FIXME : this needs more tests. """ request = TestRequest() form = TableForm(content, request) form.tableFields = Fields(*fields.values()) form.actions = Actions(Action(u'Do not use')) assert verifyObject(ITableForm, form) # We make sure getItems return the right amount of items. # This is used by ``updateLines`` to create widgets for all lines. Those # are have a line prefix: assert len(form.getItems()) == 3 # We can proceed. form.update() form.updateForm() assert len(form.lines) == len(form.lineWidgets) == 3 assert [line.prefix for line in form.lines] == [ 'form.line-0', 'form.line-1', 'form.line-2'] html = form.render() # The result should contain HTML base tags assert '<html>' in html html = etree.fromstring(html) # table headers assert [elt.text for elt in html.findall('.//table/thead//th')] == [ None, 'age', 'name']