Commit 62863ce9 authored by Tomáš Peterka's avatar Tomáš Peterka Committed by Tomáš Peterka

[renderjs_ui] Datetime field puts date in ISO format into non-editable field

/reviewed-on nexedi/erp5!538
parent 696e7ea7
......@@ -247,6 +247,11 @@
}
}
p_state.text_content = text_content;
// for noneditable element, attach data-date attribute in ISO format
// so we can use it in tests
p_state.data = {
'date': input_state.value
};
return gadget_list[0].render(p_state);
});
}
......
......@@ -179,7 +179,7 @@
</tuple>
<state>
<tuple>
<float>1465381409.41</float>
<float>1514233879.31</float>
<string>UTC</string>
</tuple>
</state>
......@@ -224,7 +224,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>964.14294.33061.33245</string> </value>
<value> <string>964.26946.11355.11605</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -242,7 +242,7 @@
</tuple>
<state>
<tuple>
<float>1513610328.86</float>
<float>1514370341.04</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -26,13 +26,20 @@
append: options.append || '',
prepend: options.prepend || ''
};
// data are dictionary thus include it only when defined so it appears
// in modification_dict only when necessary
// keys are expected to be camelCase
if (options.data !== undefined) {
state_dict.data = JSON.stringify(options.data);
}
return this.changeState(state_dict);
})
.onStateChange(function () {
.onStateChange(function (modification_dict) {
var element = this.element,
new_element = document.createElement(this.state.tag),
content = this.state.text_content;
content = this.state.text_content,
data, data_attr;
if (this.state.text_content) {
if (this.state.prepend) {
......@@ -51,6 +58,14 @@
if (this.state.alt) {
new_element.setAttribute('alt', this.state.alt);
}
if (modification_dict.hasOwnProperty("data")) {
data = JSON.parse(modification_dict.data);
for (data_attr in data) {
if (data.hasOwnProperty(data_attr)) {
new_element.dataset[data_attr] = data[data_attr];
}
}
}
// Clear first to DOM, append after to reduce flickering/manip
while (element.firstChild) {
element.removeChild(element.firstChild);
......
......@@ -136,12 +136,6 @@
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
......@@ -185,7 +179,7 @@
</tuple>
<state>
<tuple>
<float>1474443135.57</float>
<float>1514233719.27</float>
<string>UTC</string>
</tuple>
</state>
......@@ -230,7 +224,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.46335.40182.23005</string> </value>
<value> <string>964.27113.53962.34457</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,64 +242,7 @@
</tuple>
<state>
<tuple>
<float>1503909097.14</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1474442686.66</float>
<float>1514379841.99</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -81,6 +81,12 @@
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='field_my_start_date']//div[@data-gadget-scope='field']//p[@data-date='2015-12-21T11:00:00']</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/toggle_editable_mode" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
......
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