Commit cbcf4aad authored by Richard's avatar Richard

[erp5_officejs_ui_test]: update notebook test to new officejs install template

parent 34eed38a
......@@ -8,7 +8,6 @@
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="jio.js"></script>
<script src="gadget_officejs_jio_notebook.js"></script>
<link rel="stylesheet" href="iodide_master.css">
......@@ -16,5 +15,6 @@
<body>
<div id='page'></div>
<script id="jsmd" type="text/jsmd"></script>
</body>
</html>
\ No newline at end of file
......@@ -19,21 +19,25 @@
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
this.options = options;
var script = document.createElement('script');
script.setAttribute('id', 'jsmd');
script.setAttribute('type', 'text/jsmd');
script.innerHTML = options.value;
document.body.appendChild(script);
var iodide = document.createElement("script");
iodide.src = "iodide_master.js";
document.body.appendChild(iodide);
return this.changeState({
key: options.key,
value: options.value,
first_render: true
});
})
.onStateChange(function (modified_dict) {
this.element.querySelector('script').textContent = this.state.value;
if (!modified_dict.hasOwnProperty('first_render')) {
throw new Error('Sorry, it is not possible to dynamically change the iodide content');
}
var iodide = document.createElement("script");
iodide.src = "iodide_master.js";
this.element.appendChild(iodide);
})
.declareMethod("getContent", function () {
var dict = {};
dict[this.options.key] = localStorage.getItem('AUTOSAVE: untitled');
dict[this.state.key] = localStorage.getItem('AUTOSAVE: untitled');
return dict;
});
}(window, rJS, RSVP));
\ No newline at end of file
}(window, rJS, RSVP));
......@@ -23,69 +23,11 @@
<td>Reset Successfully.</td>
<td></td>
</tr>
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/officejs_notebook?ignore_layout:int=1&editable_mode:int=1</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>name=Base_createCloneDocument:method</td>
<td></td>field_my_id
</tr>
<tr>
<td>clickAndWait</td>
<td>name=Base_createCloneDocument:method</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>Created Clone Web Site</td>
<td></td>
</tr>
<tr>
<td>storeValue</td>
<td>name=field_my_id</td>
<td>test_url</td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/${test_url}/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n='Storages']</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_site_module/manage_main</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>name=ids:list</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=ids:list</td>
<td>${test_url}</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>name=manage_delObjects:method</td>
<td></td>
</tr>
<!-- Offline Test -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/${test_url}/</td>
<td></td>
</tr>
<tal:block tal:define="web_site_name python: 'officejs_notebook'">
<tal:block
metal:use-macro="here/Zuite_CommonTemplateForOfficejsUi/macros/install_offline_and_redirect"
/>
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n='Storages']</td>
......
......@@ -72,12 +72,14 @@ lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue*/
queue = lockGadgetInQueue(gadget)();
if ((modification_dict.hasOwnProperty('editable')) ||
(modification_dict.hasOwnProperty('editor'))) {
(modification_dict.hasOwnProperty('editor')) ||
(gadget.state.editor == 'notebook_editor')) {
// Clear first to DOM, append after to reduce flickering/manip
while (element.firstChild) {
element.removeChild(element.firstChild);
}
if (modification_dict.hasOwnProperty('maximize')) {
if (modification_dict.hasOwnProperty('maximize') ||
(gadget.state.editor == 'notebook_editor')) {
// for fck_editor fields, we want to be able to maximize also in non editable
if ((gadget.state.maximize && gadget.state.editable) ||
(gadget.state.maximize && gadget.state.editor === 'fck_editor')) {
......
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