Commit 3fc008de authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Romain Courteaud

[erp5_web_renderjs_ui] improve page form gadget update

- Allow to continue to edit a form while saving is on going
- Reset fields on form view update (like by clicking on the active tab from the panel)
- Fix rendering an input like gadget with the same value as rendered before causes the
  gadget to be not updated even if the field has been manually edited.

/bug #20190204-39AF19
https://nexedijs.erp5.net/#/bug_module/20190204-39AF19

/reviewed-on nexedi/erp5!861

[erp5_web_renderjs_ui] Revert partially

It seems the commit reimplement a kind of adhoc changeState

[erp5_hal_json_style] Rerender the form after a successfull edit

[erp5_web_renderjs_ui] For refresh if render is called from parent gadget.

In reality, it should be done by internally only using changeState, but that's another story

[erp5_web_renderjs_ui_test] Base_edit only trigger one ajax call

DATETIMEFIELDUPDATE clean some of romain's code

DATETIMEFIELDUPDATE add new test to check if header title is correctly updated

remove now meaningless test

use is_refresh in case of 400 error too

refresh header after saving

try toi keep the notification message

test: reuse macro

rel: no search result

revert rel change
parent 93489987
......@@ -256,4 +256,4 @@ if context.REQUEST.get('is_web_mode', False) and \
not editable_mode:
form_id = 'view'
return context.Base_redirect(keep_items={'portal_status_message': message})
return context.Base_renderForm(form_id, message=message)
......@@ -8,11 +8,20 @@
window.calculatePageTitle = function (gadget, erp5_document) {
return new RSVP.Queue()
.push(function () {
console.log(erp5_document);
var title = erp5_document.title,
portal_type = erp5_document._links.type.name;
if (/ Module$/.test(erp5_document._links.type.href)) {
return portal_type;
}
console.warn(title);
if (erp5_document.hasOwnProperty('_embedded') &&
erp5_document._embedded.hasOwnProperty('_view') &&
erp5_document._embedded._view.hasOwnProperty('_links') &&
erp5_document._embedded._view._links.hasOwnProperty('traversed_document')) {
title = erp5_document._embedded._view._links.traversed_document.title;
}
console.warn(title);
return portal_type + ': ' + title;
});
};
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.49982.38828.49698</string> </value>
<value> <string>977.28743.39054.42956</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1554209210.63</float>
<float>1564558673.18</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -96,6 +96,20 @@
return route(gadget, 'panel', 'render', [gadget.props.panel_argument_list]);
}
function refreshHeaderAndPanel(gadget, refresh) {
var promise;
if (refresh) {
promise = route(gadget, "header", 'render',
[gadget.props.header_argument_list]);
} else {
promise = updateHeader(gadget);
}
return RSVP.all([
promise,
updatePanel(gadget)
]);
}
function callJioGadget(gadget, method, param_list) {
return route(gadget, 'jio_gadget', method, param_list);
}
......@@ -541,6 +555,7 @@
if (result_list.length === 2) {
gadget.props.header_argument_list.right_title = result_list[1];
}
// return updateHeader(gadget);
});
})
......@@ -550,6 +565,11 @@
gadget.props.panel_argument_list = param_list[0];
})
.allowPublicAcquisition('refreshHeaderAndPanel',
function acquireRefreshHeaderAndPanel() {
return refreshHeaderAndPanel(this, true);
})
.allowPublicAcquisition('hidePanel', function hidePanel(param_list) {
return hideDesktopPanel(this, param_list[0]);
})
......@@ -730,10 +750,7 @@
content_container.appendChild(main_gadget.element);
element.appendChild(content_container);
return RSVP.all([
updateHeader(gadget),
updatePanel(gadget)
]);
return refreshHeaderAndPanel(gadget);
// XXX Drop notification
// return header_gadget.notifyLoaded();
}
......@@ -745,10 +762,7 @@
return page_gadget.render(gadget.state.options);
})
.push(function () {
return RSVP.all([
updateHeader(gadget),
updatePanel(gadget)
]);
return refreshHeaderAndPanel(gadget);
}));
}
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>975.29292.10042.3754</string> </value>
<value> <string>977.29032.37767.29337</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1556870187.8</float>
<float>1564576235.32</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -113,6 +113,7 @@ and handling data send&receive.
.declareAcquiredMethod("translate", "translate")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("updatePanel", "updatePanel")
.declareAcquiredMethod("refreshHeaderAndPanel", "refreshHeaderAndPanel")
.declareAcquiredMethod("notifyChange", "notifyChange")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")
......@@ -178,7 +179,8 @@ and handling data send&receive.
erp5_document: undefined,
erp5_form: undefined,
url: undefined,
embedded: asBoolean(options.embedded)
embedded: asBoolean(options.embedded),
is_refresh: options.is_refresh || false
};
// options.editable differs when it comes from the erp5_launcher of FormBox - try to unify it here
......@@ -277,7 +279,7 @@ and handling data send&receive.
erp5_document = JSON.parse(gadget.state.erp5_document),
erp5_form = JSON.parse(gadget.state.erp5_form);
if (modification_dict.hasOwnProperty('url')) {
if ((!gadget.state.is_refresh) || modification_dict.hasOwnProperty('url')) {
queue = gadget.declareGadget(gadget.state.url, {scope: "fg"});
} else {
queue = gadget.getDeclaredGadget("fg");
......@@ -300,7 +302,7 @@ and handling data send&receive.
return page_template_gadget.render(sub_options);
})
.push(function () {
if (modification_dict.hasOwnProperty('url')) {
if ((!gadget.state.is_refresh) || modification_dict.hasOwnProperty('url')) {
return page_template_gadget.getElement()
.push(function (fragment) {
var element = gadget.element;
......@@ -409,6 +411,7 @@ and handling data send&receive.
// We modify inplace state.options because render method uses and removes
// erp5_document hidden in its options.
options.erp5_document = erp5_document;
options.is_refresh = true;
return new RSVP.Queue()
.push(function () {
if (response_view._notification === undefined) {
......@@ -431,6 +434,9 @@ and handling data send&receive.
*/
return gadget.render(options);
})
.push(function () {
return gadget.refreshHeaderAndPanel();
})
.push(function () {
// Make sure to return nothing (previous render can return
// something) so the successfull handler does not receive
......@@ -556,7 +562,8 @@ and handling data send&receive.
var erp5_document = JSON.parse(gadget.state.erp5_document);
erp5_document._embedded._view = response;
erp5_document._now = Date.now();
return gadget.changeState({erp5_document: JSON.stringify(erp5_document)});
return gadget.changeState({erp5_document: JSON.stringify(erp5_document),
is_refresh: true});
});
}
})
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>976.34271.30288.29832</string> </value>
<value> <string>977.29026.45165.46643</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1561044454.34</float>
<float>1564575621.78</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -185,9 +185,12 @@
"select_list": [catalog_index]
})
.push(function (result) {
if (!result.data.total_rows) {
return;
}
return gadget.changeState({
value_text: result.data.rows[0]
.value[catalog_index]
.value[catalog_index]
});
})
.push(function () {
......@@ -251,8 +254,10 @@
// User selected a document from a listbox
if ((gadget.state.value_uid) && (!gadget.state.value_text)) {
plane.className = SEARCHING_CLASS_STR;
return gadget.detachChangeState(gadget.state.value_uid,
gadget.state.catalog_index);
gadget.detachChangeState(gadget.state.value_uid,
gadget.state.catalog_index);
// return gadget.notifyChange();
return;
}
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>977.6117.6830.21572</string> </value>
<value> <string>977.29169.10603.24883</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1563260997.53</float>
<float>1564584174.58</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -42,7 +42,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testDialogLinesField</string> </value>
<value> <string>testDateTimeFieldUpdate</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
......
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test RenderJS UI</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test RenderJS UI</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<!-- Clean Up -->
<tr>
<td>open</td>
<td>${base_url}/bar_module/ListBoxZuite_reset</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Reset Successfully.</td>
<td></td>
</tr>
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/bar_module/BarModule_createObjects?num:int=1</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Created Successfully.</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/bar_module/0?editable=true</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/go_to_bar_datetime_field_view" />
<!-- Actual test -->
<tr>
<td>waitForElementPresent</td>
<td>//input[@name='field_my_start_date']</td>
<td></td>
</tr>
<tr>
<td>storeValue</td>
<td>//input[@name='field_my_start_date']</td>
<td>start_date_value</td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='field_my_start_date']</td>
<td>2019-04-23T01:01:00</td>
</tr>
<tr>
<td>chooseOkOnNextConfirmation</td>
<td></td>
<td></td>
</tr>
<tr>
<td>click</td> <!-- using go_to_bar_datetime_field_view, chooseOkOnNextConfirmation does not work -->
<td>//a[@class="active" and text()='DateTimeField']</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_confirmation" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>pause</td> <!-- necessary to wait for field to be updated -->
<td>1000</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name='field_my_start_date']</td>
<td>${start_date_value}</td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Dialog Main</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test that the content of LinesField textarea doesn't change when sort button in sub document list is clicked</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<!-- Shortcut for full renderjs url -->
<tr><td>store</td>
<td>${base_url}/web_site_module/renderjs_runner</td>
<td>renderjs_url</td></tr>
<tr><td>open</td>
<td>${renderjs_url}/#/foo_module/1?editable=1</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_field_lines.html"]//textarea</td><td></td></tr>
<tr><td>type</td>
<td>field_my_lines_list</td>
<td>foo<br/><!-- tags and comments get stripped away -->
bar</td></tr>
<!-- Change sorting of the listbox -->
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_field_listbox.html"]//table/thead/tr/th/a[text()='Title']</td><td></td></tr>
<tr>
<td>chooseOkOnNextConfirmation</td>
<td></td>
<td></td>
</tr>
<tr><td>click</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_field_listbox.html"]//table/thead/tr/th/a[text()='Title']</td><td></td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_confirmation" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr><td>assertValue</td>
<td>//textarea[@name='field_my_lines_list']</td>
<td>foo<br/>
bar</td></tr>
<!-- Save and force unloading of Form and its content from the memory by going back -->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
<tr><td>click</td>
<td>//div[@data-role='header']//h1/a</td><td></td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_field_listbox.html']//table/tbody/tr//a</td><td></td></tr>
<tr><td>click</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_field_listbox.html']//table/tbody/tr[1]//a</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_field_lines.html"]//textarea</td><td></td></tr>
<!-- Assert value still holds and change it -->
<tr><td>assertValue</td>
<td>//textarea[@name='field_my_lines_list']</td>
<td>foo<br/>
bar</td></tr>
<tr><td>assertValue</td>
<td>//textarea[@name='field_my_lines_list']</td>
<td>foo<br/>
bar</td></tr>
<tr><td>type</td>
<td>//textarea[@name='field_my_lines_list']</td>
<td>foo bar</td></tr>
<tr>
<td>chooseOkOnNextConfirmation</td>
<td></td>
<td></td>
</tr>
<tr><td>click</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_field_listbox.html"]//table/thead/tr/th/a[text()='Title']</td>
<td></td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_confirmation" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr><td>assertValue</td>
<td>//textarea[@name='field_my_lines_list']</td>
<td>foo bar</td></tr>
<!-- Save and force unloading of Form and its content from the memory by going back -->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
<tr><td>click</td>
<td>//div[@data-role='header']//h1/a</td><td></td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_field_listbox.html']//table/tbody/tr//a</td><td></td></tr>
<tr><td>click</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_field_listbox.html']//table/tbody/tr[1]//a</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_field_lines.html"]//textarea</td><td></td></tr>
<tr><td>assertValue</td>
<td>//textarea[@name='field_my_lines_list']</td>
<td>foo bar</td></tr>
</body>
</html>
\ No newline at end of file
......@@ -29,8 +29,10 @@
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tr>
<td>waitForElementPresent</td>
<td>assertElementPresent</td>
<td>//a[@data-i18n='Add']</td>
<td></td>
</tr>
......@@ -40,16 +42,17 @@
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tr>
<td>waitForTextPresent</td>
<td>Save</td>
<td></td>
</tr>
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Object created.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>assertTextPresent</td>
<td>Save</td>
<td></td>
</tr>
<tr>
<td>assertSelected</td>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testFormViewEditableNextWithEditedField</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Form View Next With Edited Field</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Form View Next With Edited Field, two Foos have empty short title, one is edited but not saved, next short title field should be reset.</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<!-- Clean Up -->
<tr>
<td>open</td>
<td>&#36;{base_url}/foo_module/ListBoxZuite_reset</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Reset Successfully.</td>
<td></td>
</tr>
<!-- Initialize -->
<tr>
<td>open</td>
<td>&#36;{base_url}/foo_module/FooModule_createObjects?num:int=2</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Created Successfully.</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module?editable=true</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tr>
<td>click</td>
<td>//a[text()='Title 0']</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>type</td>
<td>field_my_short_title</td>
<td>Hello</td>
</tr>
<tr>
<td>chooseOkOnNextConfirmation</td>
<td></td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='header']//a[text()='Next' and contains(@href, '#!selection_next')]</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_confirmation" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>pause</td> <!-- necessary to wait for field to be updated -->
<td>1000</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_my_short_title</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testFormViewEditableSaveActionContinuingEditingInputField</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Form View Editable Save Action Continuing Editing Input Field</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Form View Editable Save Action Continuing Editing Input Field, one Foo have empty short title which is edited, saved and edited during the saving process. New typed values should be kept.</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module/1?editable=true</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tr>
<td>type</td>
<td>field_my_short_title</td>
<td>Hello</td>
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='header']//button[text()='Save' and @type='submit']</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>field_my_short_title</td>
<td>World</td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<!-- saving should not prevent to continue to edit the document -->
<tr>
<td>pause</td> <!-- necessary to wait for field to be updated -->
<td>1000</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_my_short_title</td>
<td>World</td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/foo_module/1/getShortTitle</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Hello</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testFormViewEditableSaveActionContinuingEditingLinesField</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Form View Editable Save Action Continuing Editing Lines Field</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Form View Editable Save Action Continuing Editing Lines Field, one Foo have empty line list which is edited, saved and edited during the saving process. New typed values should be kept.</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module/1?editable=true</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tr>
<td>type</td>
<td>field_my_lines_list</td>
<td>Hello</td>
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='header']//button[text()='Save' and @type='submit']</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>field_my_lines_list</td>
<td>World</td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<!-- saving should not prevent to continue to edit the document -->
<tr>
<td>pause</td> <!-- necessary to wait for field to be updated -->
<td>1000</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_my_lines_list</td>
<td>World</td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/foo_module/1/getProperty?key=lines_list</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>('Hello',)</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testFormViewEditableTitle</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Form View Editable Save Action Continuing Editing Lines Field</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Form View Editable Save Action Continuing Editing Lines Field, one Foo have empty line list which is edited, saved and edited during the saving process. New typed values should be kept.</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module/1?editable=true</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tr>
<td>verifyValue</td>
<td>field_my_title</td>
<td>Title 1</td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope="header"]//*[text()="Foo: Title 1"]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>field_my_title</td>
<td>New Title for Test 1</td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
<tr>
<td>verifyValue</td>
<td>field_my_title</td>
<td>New Title for Test 1</td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope="header"]//*[text()="Foo: New Title for Test 1"]</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
......@@ -40,28 +40,18 @@
<tr>
<td colspan="3"><b>Save</b></td>
</tr>
<!-- First loader while calling Base_edit -->
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_header.html')]//h1//*[contains(@class, "ui-icon-spinner")]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_header.html')]//h1//*[contains(@class, "ui-icon-spinner")]</td>
<td></td>
</tr>
<!-- Save Button is disabled -->
<tr>
<td>verifyElementPresent</td>
<td>//button[@data-i18n="Save"][contains(@class, "ui-disabled")]</td>
<td></td>
</tr>
<!-- First loader while calling Base_edit -->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Data updated.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>verifyElementPresent</td>
<td>//button[@data-i18n="Save"][contains(@class, "ui-icon-check")]</td>
......
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