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 !1018
parents 72a2977a 7847b5db
Pipeline #7282 failed with stage
in 0 seconds
...@@ -172,7 +172,8 @@ ...@@ -172,7 +172,8 @@
.push(addExtraLibrary('./monaco-jio.d.ts', 'jio')); .push(addExtraLibrary('./monaco-jio.d.ts', 'jio'));
} }
if (modification_dict.hasOwnProperty('editable')){ if (modification_dict.hasOwnProperty('editable')){
gadget.editor.updateOptions({readOnly: !this.state.editable}); this.editor.updateOptions({readOnly: !this.state.editable});
}
} }
return queue; return queue;
}) })
......
...@@ -90,9 +90,16 @@ ...@@ -90,9 +90,16 @@
<td>//a[@data-i18n="View"]</td><td></td></tr> <td>//a[@data-i18n="View"]</td><td></td></tr>
<tr><td>click</td> <tr><td>click</td>
<td>//a[@data-i18n="View"]</td><td></td></tr> <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> <tr><td>waitForText</td>
<td>//div[@data-gadget-scope="field_my_text_content"]//pre</td> <td>//body</td>
<td>Hello</td></tr> <!-- we have line number -->
<td>glob:1*Hello</td></tr>
<tr><td>selectFrame</td>
<td>relative=top</td><td></td></tr>
</tbody></table> </tbody></table>
</body> </body>
......
...@@ -66,9 +66,15 @@ ...@@ -66,9 +66,15 @@
<tr><td>click</td> <tr><td>click</td>
<td>//div[@class="actions"]//span[text() = "View"]</td><td></td></tr> <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> <tr><td>waitForText</td>
<td>css=.bottom pre</td> <td>//body</td>
<td>Hello</td></tr> <td>glob:1*Hello</td></tr>
<tr><td>selectFrame</td>
<td>relative=top</td><td></td></tr>
</tbody></table> </tbody></table>
</body> </body>
......
...@@ -74,7 +74,6 @@ class File(Document, CMFFile): ...@@ -74,7 +74,6 @@ class File(Document, CMFFile):
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default global values # 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__ data = '' # A hack required to use OFS.Image.index_html without calling OFS.Image.__init__
# Default Properties # Default Properties
......
...@@ -1379,10 +1379,7 @@ class TestERP5Base(ERP5TypeTestCase): ...@@ -1379,10 +1379,7 @@ class TestERP5Base(ERP5TypeTestCase):
self.assertEqual('organisation@example.com', self.assertEqual('organisation@example.com',
organisation.getAlternateEmailCoordinateText()) organisation.getAlternateEmailCoordinateText())
# Marked as expectedFailure as it shall be never possible to use edit method to set def test_content_type_local_property(self):
# local property which would override existing method
@expectedFailure
def test_content_type_property(self):
portal_type = 'Person' portal_type = 'Person'
person_module = self.portal.getDefaultModule(portal_type) person_module = self.portal.getDefaultModule(portal_type)
person = person_module.newContent(portal_type=portal_type) person = person_module.newContent(portal_type=portal_type)
...@@ -1393,6 +1390,20 @@ class TestERP5Base(ERP5TypeTestCase): ...@@ -1393,6 +1390,20 @@ class TestERP5Base(ERP5TypeTestCase):
# edit content_type on document which has no content_type property configured # edit content_type on document which has no content_type property configured
person.edit(content_type='text/xml') 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): def test_BankAccount_validateIBAN(self):
self.assertTrue( self.assertTrue(
self.portal.BankAccount_validateIBAN( self.portal.BankAccount_validateIBAN(
......
...@@ -637,6 +637,12 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate): ...@@ -637,6 +637,12 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
objectItems = ZMIForm.objectItems objectItems = ZMIForm.objectItems
objectValues = ZMIForm.objectValues 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', def __init__(self, id, title, unicode_mode=0, encoding='UTF-8',
stored_encoding='UTF-8'): stored_encoding='UTF-8'):
"""Initialize form. """Initialize form.
......
...@@ -847,6 +847,8 @@ class Base( CopyContainer, ...@@ -847,6 +847,8 @@ class Base( CopyContainer,
security.declareProtected( Permissions.AccessContentsInformation, 'getId' ) security.declareProtected( Permissions.AccessContentsInformation, 'getId' )
getId = BaseAccessor.Getter('getId', 'id', 'string') getId = BaseAccessor.Getter('getId', 'id', 'string')
content_type = None # content_type is a property in ERP5, but a method in CMF
# Debug # Debug
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getOid') 'getOid')
......
...@@ -707,6 +707,7 @@ class Folder(OFSFolder2, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn): ...@@ -707,6 +707,7 @@ class Folder(OFSFolder2, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn):
PUT_factory = None PUT_factory = None
# XXX Prevent inheritance from PortalFolderBase # XXX Prevent inheritance from PortalFolderBase
description = None description = None
content_type = None # content_type is a property in ERP5, but a method in CMF
# Per default we use BTree folder # Per default we use BTree folder
_folder_handler = BTREE_HANDLER _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