'Regression tests for #11791: Inclusion tag result_list generates a
table and this checks that the items are nested within the table
element tags.
Also a regression test for #13599, verifies that hidden fields
when list_editable is enabled are rendered in a div outside the
table.'

def test_result_list_editable_html(self):

    new_parent = Parent.objects.create(name=u'parent')
    new_child = Child.objects.create(name=u'name', parent=new_parent)
    request = self.factory.get(u'/child/')
    m = ChildAdmin(Child, admin.site)
    m.list_display = [u'id', u'name', u'parent']
    m.list_display_links = [u'id']
    m.list_editable = [u'name']
    cl = ChangeList(request, Child, m.list_display, m.list_display_links, m.list_filter, m.date_hierarchy, m.search_fields, m.list_select_related, m.list_per_page, m.list_max_show_all, m.list_editable, m)
    FormSet = m.get_changelist_formset(request)
    cl.formset = FormSet(queryset=cl.result_list)
    template = Template(u'{%    load    admin_list    %}{%    spaceless    %}{%    result_list    cl    %}{%    endspaceless    %}')
    context = Context({u'cl': cl})
    table_output = template.render(context)
    hiddenfields_div = (u'<div    class="hiddenfields"><input    type="hidden"    name="form-0-id"    value="%d"    id="id_form-0-id"    /></div>' % new_child.id)
    self.assertInHTML(hiddenfields_div, table_output, msg_prefix=u'Failed    to    find    hidden    fields')
    editable_name_field = u'<input    name="form-0-name"    value="name"    class="vTextField"    maxlength="30"    type="text"    id="id_form-0-name"    />'
    self.assertInHTML((u'<td>%s</td>' % editable_name_field), table_output, msg_prefix=u'Failed    to    find    "name"    list_editable    field')
