Commit 74f09af3 authored by Jérome Perrin's avatar Jérome Perrin

Fix broken tests after !1011

Fix broken tests after !1011 it was merged too fast.

/reviewed-on nexedi/erp5!1018
parents 72a2977a 7847b5db
......@@ -171,8 +171,9 @@
.push(addExtraLibrary('./monaco-renderjs.d.ts', 'renderjs'))
.push(addExtraLibrary('./monaco-jio.d.ts', 'jio'));
}
if (modification_dict.hasOwnProperty('editable')){
gadget.editor.updateOptions({readOnly: !this.state.editable});
if (modification_dict.hasOwnProperty('editable')){
this.editor.updateOptions({readOnly: !this.state.editable});
}
}
return queue;
})
......
......@@ -90,9 +90,16 @@
<td>//a[@data-i18n="View"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="View"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="editor"]//iframe</td><td></td></tr>
<tr><td>selectFrame</td>
<td>//div[@data-gadget-scope="editor"]//iframe</td><td></td></tr>
<tr><td>waitForText</td>
<td>//div[@data-gadget-scope="field_my_text_content"]//pre</td>
<td>Hello</td></tr>
<td>//body</td>
<!-- we have line number -->
<td>glob:1*Hello</td></tr>
<tr><td>selectFrame</td>
<td>relative=top</td><td></td></tr>
</tbody></table>
</body>
......
......@@ -66,9 +66,15 @@
<tr><td>click</td>
<td>//div[@class="actions"]//span[text() = "View"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>css=.bottom iframe</td><td></td></tr>
<tr><td>selectFrame</td>
<td>css=.bottom iframe</td><td></td></tr>
<tr><td>waitForText</td>
<td>css=.bottom pre</td>
<td>Hello</td></tr>
<td>//body</td>
<td>glob:1*Hello</td></tr>
<tr><td>selectFrame</td>
<td>relative=top</td><td></td></tr>
</tbody></table>
</body>
......
......@@ -74,7 +74,6 @@ class File(Document, CMFFile):
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default global values
content_type = '' # Required for WebDAV support (default value)
data = '' # A hack required to use OFS.Image.index_html without calling OFS.Image.__init__
# Default Properties
......
......@@ -1379,10 +1379,7 @@ class TestERP5Base(ERP5TypeTestCase):
self.assertEqual('organisation@example.com',
organisation.getAlternateEmailCoordinateText())
# Marked as expectedFailure as it shall be never possible to use edit method to set
# local property which would override existing method
@expectedFailure
def test_content_type_property(self):
def test_content_type_local_property(self):
portal_type = 'Person'
person_module = self.portal.getDefaultModule(portal_type)
person = person_module.newContent(portal_type=portal_type)
......@@ -1393,6 +1390,20 @@ class TestERP5Base(ERP5TypeTestCase):
# edit content_type on document which has no content_type property configured
person.edit(content_type='text/xml')
def test_EmbeddedFile_content_type(self):
embedded_file = self.portal.person_module.newContent(
portal_type='Person'
).newContent(
portal_type='Embedded File'
)
self.assertFalse(embedded_file.hasContentType())
self.assertEqual('text/plain', embedded_file.getContentType('text/plain'))
embedded_file.edit(content_type='text/xml')
self.assertEqual('text/xml', embedded_file.getContentType())
self.assertEqual('text/xml', embedded_file.getProperty('content_type'))
def test_BankAccount_validateIBAN(self):
self.assertTrue(
self.portal.BankAccount_validateIBAN(
......
......@@ -637,6 +637,12 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
objectItems = ZMIForm.objectItems
objectValues = ZMIForm.objectValues
# If content_type is not text/html ZopePageTemplate will check that the
# source is well formed XML, but this does not really applies to Forms,
# they don't have source. By setting content_type here we make sure we
# don't get ERP5Type's Base default content_type.
content_type = ZopePageTemplate.content_type
def __init__(self, id, title, unicode_mode=0, encoding='UTF-8',
stored_encoding='UTF-8'):
"""Initialize form.
......
......@@ -847,6 +847,8 @@ class Base( CopyContainer,
security.declareProtected( Permissions.AccessContentsInformation, 'getId' )
getId = BaseAccessor.Getter('getId', 'id', 'string')
content_type = None # content_type is a property in ERP5, but a method in CMF
# Debug
security.declareProtected(Permissions.AccessContentsInformation,
'getOid')
......
......@@ -707,6 +707,7 @@ class Folder(OFSFolder2, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn):
PUT_factory = None
# XXX Prevent inheritance from PortalFolderBase
description = None
content_type = None # content_type is a property in ERP5, but a method in CMF
# Per default we use BTree folder
_folder_handler = BTREE_HANDLER
......
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