Commit 7924d351 authored by Jérome Perrin's avatar Jérome Perrin

Re-enable "Diff Object" "Diff Module Objects" for users

This is used and should not be disabled.

There was an error when clicking this dialog, fix that error instead.

See merge request nexedi/erp5!1301
parents 01310e93 813d4942
......@@ -264,6 +264,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
expected = {'folder': [],
'global': [],
'object': [],
'object_action': [{'id': 'diff_object_action', 'title': 'Diff Object'}],
'object_exchange': [{'id': 'csv_export', 'title': 'Export Csv File'}], # erp5_csv_style
'object_hidden': [{'id': 'view_historical_comparison',
'title': 'View Historical Comparison'},
......@@ -285,6 +286,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
expected = {'folder': [],
'global': [],
'object': [],
'object_action': [{'id': 'diff_object_action', 'title': 'Diff Object'}],
'object_exchange': [{'id': 'csv_export', 'title': 'Export Csv File'}], # erp5_csv_style
'object_hidden': [{'id': 'view_historical_comparison',
'title': 'View Historical Comparison'},
......
......@@ -63,48 +63,56 @@
<td>Diff Module Objects</td>
</tr>
<!-- Check the diff content -->
<tr>
<td>verifyValue</td>
<td>field_your_first_path</td>
<td>bar_module/1</td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_your_second_path</td>
<td>bar_module/2</td>
</tr>
<tal:block tal:repeat="_ python: (1, 2)">
<tr>
<td>assertText</td>
<td>//a[@class="listbox_title"]</td>
<td>exact:Diff</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//tr[@class='listbox-data-line-2 DataA']</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//tr[@class='listbox-data-line-2 DataA']/td[1]</td>
<td>title</td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//tr[@class='listbox-data-line-2 DataA']/td[2]/div[@data-gadget-sandbox="public"]</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>document.querySelector('#selenium_myiframe').contentWindow.document.evaluate("//tr[@class='listbox-data-line-2 DataA']/td[2]/div[@data-gadget-sandbox='public']", document.querySelector('#selenium_myiframe').contentWindow.document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.getAttribute('data-gadget-value');</td>
<td>_data_gadget_value</td>
</tr>
<tr>
<td>verifyEval</td>
<td>storedVars['_data_gadget_value'].replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/\s+/g, '')</td>
<td>---+++@@-1+1@@-Title1+Title2</td>
</tr>
<!-- Check the diff content -->
<tr>
<td>verifyValue</td>
<td>field_your_first_path</td>
<td>bar_module/1</td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_your_second_path</td>
<td>bar_module/2</td>
</tr>
<tr>
<td>assertText</td>
<td>//a[@class="listbox_title"]</td>
<td>exact:Diff</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//tr[@class='listbox-data-line-2 DataA']</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//tr[@class='listbox-data-line-2 DataA']/td[1]</td>
<td>title</td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//tr[@class='listbox-data-line-2 DataA']/td[2]/div[@data-gadget-sandbox="public"]</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>document.querySelector('#selenium_myiframe').contentWindow.document.evaluate("//tr[@class='listbox-data-line-2 DataA']/td[2]/div[@data-gadget-sandbox='public']", document.querySelector('#selenium_myiframe').contentWindow.document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.getAttribute('data-gadget-value');</td>
<td>_data_gadget_value</td>
</tr>
<tr>
<td>verifyEval</td>
<td>storedVars['_data_gadget_value'].replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/\s+/g, '')</td>
<td>---+++@@-1+1@@-Title1+Title2</td>
</tr>
<!-- submit the action again, it should be same -->
<tr>
<td>clickAndWait</td>
<td>dialog_submit_button</td>
<td></td>
</tr>
</tal:block>
</body>
</html>
\ No newline at end of file
......@@ -54,48 +54,58 @@
<td>Diff Object</td>
</tr>
<!-- Check the diff content -->
<tr>
<td>verifyValue</td>
<td>field_your_first_path</td>
<td>bar_module/1</td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_your_second_path</td>
<td>bar_module/1</td>
</tr>
<tal:block tal:repeat="_ python: (1, 2)">
<tr>
<td>assertText</td>
<td>//a[@class="listbox_title"]</td>
<td>exact:Diff</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//tr[@class='listbox-data-line-1 DataB']</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//tr[@class='listbox-data-line-1 DataB']/td[1]</td>
<td>title</td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//tr[@class='listbox-data-line-1 DataB']/td[2]/div[@data-gadget-sandbox="public"]</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>document.querySelector('#selenium_myiframe').contentWindow.document.evaluate("//tr[@class='listbox-data-line-1 DataB']/td[2]/div[@data-gadget-sandbox='public']", document.querySelector('#selenium_myiframe').contentWindow.document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.getAttribute('data-gadget-value');</td>
<td>_data_gadget_value</td>
</tr>
<tr>
<td>verifyEval</td>
<td>storedVars['_data_gadget_value'].replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/\s+/g, '')</td>
<td>---+++@@-1+1@@-Title1+Title2</td>
</tr>
<!-- Check the diff content -->
<tr>
<td>verifyValue</td>
<td>field_your_first_path</td>
<td>bar_module/1</td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_your_second_path</td>
<td>bar_module/1</td>
</tr>
<tr>
<td>assertText</td>
<td>//a[@class="listbox_title"]</td>
<td>exact:Diff</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//tr[@class='listbox-data-line-1 DataB']</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//tr[@class='listbox-data-line-1 DataB']/td[1]</td>
<td>title</td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//tr[@class='listbox-data-line-1 DataB']/td[2]/div[@data-gadget-sandbox="public"]</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>document.querySelector('#selenium_myiframe').contentWindow.document.evaluate("//tr[@class='listbox-data-line-1 DataB']/td[2]/div[@data-gadget-sandbox='public']", document.querySelector('#selenium_myiframe').contentWindow.document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.getAttribute('data-gadget-value');</td>
<td>_data_gadget_value</td>
</tr>
<tr>
<td>verifyEval</td>
<td>storedVars['_data_gadget_value'].replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/\s+/g, '')</td>
<td>---+++@@-1+1@@-Title1+Title2</td>
</tr>
<!-- submit the action again, it should be same -->
<tr>
<td>clickAndWait</td>
<td>dialog_submit_button</td>
<td></td>
</tr>
</tal:block>
</body>
</html>
\ No newline at end of file
......@@ -38,7 +38,7 @@
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Manage portal</string>
<string>View</string>
</tuple>
</value>
</item>
......
......@@ -38,7 +38,7 @@
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Manage portal</string>
<string>View</string>
</tuple>
</value>
</item>
......
......@@ -98,7 +98,7 @@ if ((first_path is None and second_path is None) and
# In case the list_selection_name is there, it can be the case of selection
# from the module, hence we get the paths from the selection and use them to
# create diff.
if list_selection_name is not None:
if list_selection_name:
selected_object_list = portal.portal_selections.getSelectionCheckedValueList(
selection_name=list_selection_name)
first_object = selected_object_list[0]
......
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