Commit 484b558b authored by Jérome Perrin's avatar Jérome Perrin

core: display listfields sorted by label in Base_getMultiListFieldPropertyDictList

parent 02825d8c
...@@ -49,6 +49,19 @@ ...@@ -49,6 +49,19 @@
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
<tr>
<td colspan="3"><b>Listfields are displayed in alphabetic order</b></td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']/div/label</td>
<td>Foo Category</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']/div/label</td>
<td>foo_big_category</td>
</tr>
<tr> <tr>
<td colspan="3"><b>Empty value by default</b></td> <td colspan="3"><b>Empty value by default</b></td>
</tr> </tr>
...@@ -89,12 +102,12 @@ ...@@ -89,12 +102,12 @@
<tr> <tr>
<td>select</td> <td>select</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//select</td>
<td>label=c1</td> <td>label=a/a1</td>
</tr> </tr>
<tr> <tr>
<td>select</td> <td>select</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//select</td>
<td>label=a/a1</td> <td>label=c1</td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
...@@ -106,12 +119,12 @@ ...@@ -106,12 +119,12 @@
<tr> <tr>
<td>assertSelected</td> <td>assertSelected</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//select</td>
<td>label=c1</td> <td>label=a/a1</td>
</tr> </tr>
<tr> <tr>
<td>assertSelected</td> <td>assertSelected</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//select</td>
<td>label=a/a1</td> <td>label=c1</td>
</tr> </tr>
<tr> <tr>
<td>assertElementNotPresent</td> <td>assertElementNotPresent</td>
......
...@@ -45,6 +45,19 @@ ...@@ -45,6 +45,19 @@
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
<tr>
<td colspan="3"><b>Listfields are displayed in alphabetic order</b></td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']/div/label</td>
<td>Foo Category</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']/div/label</td>
<td>foo_big_category</td>
</tr>
<tr> <tr>
<td colspan="3"><b>Empty value by default</b></td> <td colspan="3"><b>Empty value by default</b></td>
</tr> </tr>
...@@ -80,18 +93,18 @@ ...@@ -80,18 +93,18 @@
<tr> <tr>
<td>select</td> <td>select</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div//select</td>
<td>label=c1</td> <td>label=a</td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
<tr> <tr>
<td>assertText</td> <td>assertText</td>
<td>//p[@id="field_category_list"]</td> <td>//p[@id="field_category_list"]</td>
<td>foo_big_category/c1</td> <td>foo_category/a</td>
</tr> </tr>
<tr> <tr>
<td>assertSelected</td> <td>assertSelected</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td>
<td>label=c1</td> <td>label=a</td>
</tr> </tr>
<tr> <tr>
<td>assertSelected</td> <td>assertSelected</td>
...@@ -120,7 +133,7 @@ ...@@ -120,7 +133,7 @@
<tr> <tr>
<td>select</td> <td>select</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div//select</td>
<td>label=a</td> <td>label=c1</td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
<tr> <tr>
...@@ -131,7 +144,7 @@ ...@@ -131,7 +144,7 @@
<tr> <tr>
<td>assertSelected</td> <td>assertSelected</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td>
<td>label=c1</td> <td>label=a</td>
</tr> </tr>
<tr> <tr>
<td>assertSelected</td> <td>assertSelected</td>
...@@ -146,7 +159,7 @@ ...@@ -146,7 +159,7 @@
<tr> <tr>
<td>assertSelected</td> <td>assertSelected</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[1]//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[1]//select</td>
<td>label=a</td> <td>label=c1</td>
</tr> </tr>
<tr> <tr>
<td>assertSelected</td> <td>assertSelected</td>
...@@ -164,7 +177,7 @@ ...@@ -164,7 +177,7 @@
</tr> </tr>
<tr> <tr>
<td>select</td> <td>select</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[2]//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[2]//select</td>
<td>label=c22</td> <td>label=c22</td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
...@@ -176,45 +189,46 @@ ...@@ -176,45 +189,46 @@
<tr> <tr>
<td>assertSelected</td> <td>assertSelected</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td>
<td>label=c1</td> <td>label=a</td>
</tr> </tr>
<tr> <tr>
<td>assertSelected</td> <td>assertSelected</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[2]//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[2]//select</td>
<td>label=c22</td>
</tr>
<tr>
<td>assertSelected</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[3]//select</td>
<td>label=</td> <td>label=</td>
</tr> </tr>
<tr> <tr>
<td>assertElementNotPresent</td> <td>assertElementNotPresent</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[4]</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[3]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertSelected</td> <td>assertSelected</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[1]//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[1]//select</td>
<td>label=a</td> <td>label=c1</td>
</tr> </tr>
<tr> <tr>
<td>assertSelected</td> <td>assertSelected</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[2]//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[2]//select</td>
<td>label=c22</td>
</tr>
<tr>
<td>assertSelected</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[3]//select</td>
<td>label=</td> <td>label=</td>
</tr> </tr>
<tr> <tr>
<td>assertElementNotPresent</td> <td>assertElementNotPresent</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[3]</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[4]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td colspan="3"><b>Remove first value</b></td> <td colspan="3"><b>Remove first foo_big_category</b></td>
</tr> </tr>
<tr> <tr>
<td>select</td> <td>select</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[1]//select</td>
<td>label=</td> <td>label=</td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
...@@ -226,7 +240,7 @@ ...@@ -226,7 +240,7 @@
<tr> <tr>
<td>assertSelected</td> <td>assertSelected</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div[1]//select</td>
<td>label=c22</td> <td>label=a</td>
</tr> </tr>
<tr> <tr>
<td>assertSelected</td> <td>assertSelected</td>
...@@ -241,7 +255,7 @@ ...@@ -241,7 +255,7 @@
<tr> <tr>
<td>assertSelected</td> <td>assertSelected</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[1]//select</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div[1]//select</td>
<td>label=a</td> <td>label=c22</td>
</tr> </tr>
<tr> <tr>
<td>assertSelected</td> <td>assertSelected</td>
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<!-- Check that Category titles in parallel_list_field are well translated --> <!-- Check that Category titles in parallel_list_field are well translated -->
<tr> <tr>
<td>assertText</td> <td>assertText</td>
<td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_1']//div//label</td> <td>//div[@data-gadget-scope='field_my_category_list']//div[@data-gadget-scope='PARALLEL_SUB_FIELD_0']//div//label</td>
<td>Foo leibie</td> <td>Foo leibie</td>
</tr> </tr>
......
...@@ -42,4 +42,6 @@ for item in item_list: ...@@ -42,4 +42,6 @@ for item in item_list:
# Return the list of subfield configuration. # Return the list of subfield configuration.
return sub_field_dict.values() return sorted(
sub_field_dict.values(),
key=lambda v: v['title'])
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