Commit 0375d59e authored by Romain Courteaud's avatar Romain Courteaud

Revert "[renderjs_ui] Remove duplicite thead templates for ListBox Field"

This reverts commit 82c5ae6f.

Add a test to check that hidden rows action update the listbox head
parent 7079082b
......@@ -20,7 +20,7 @@
<!-- custom script -->
<script src="gadget_erp5_field_listbox.js" type="text/javascript"></script>
<script id="listbox-thead-template" type="text/x-handlebars-template">
<script id="listbox-hidden-thead-template" type="text/x-handlebars-template">
<table>
<thead class="ui-bar-inherit head">
<tr>
......@@ -42,6 +42,25 @@
</table>
</script>
<script id="listbox-show-thead-template" type="text/x-handlebars-template">
<table>
<thead class="ui-bar-inherit head">
<tr>
{{#if show_anchor}}
<th data-i18n="Jump">Jump</th>
{{/if}}
<th></th>
{{#each head_value}}
<th data-i18n="{{data-i18n}}" class="{{class_value}}">{{text}}</th>
{{/each}}
{{#if line_icon}}
<th></th>
{{/if}}
</tr>
</thead>
</table>
</script>
<script id="listbox-hidden-tbody-template" type="text/x-handlebars-template">
<table>
<tbody class="tbody">
......
......@@ -5,10 +5,14 @@
SimpleQuery, ComplexQuery, Query, Handlebars, console, QueryFactory) {
"use strict";
var gadget_klass = rJS(window),
listbox_thead_source = gadget_klass.__template_element
.getElementById("listbox-thead-template")
listbox_hidden_thead_source = gadget_klass.__template_element
.getElementById("listbox-hidden-thead-template")
.innerHTML,
listbox_thead_template = Handlebars.compile(listbox_thead_source),
listbox_hidden_thead_template = Handlebars.compile(listbox_hidden_thead_source),
listbox_show_thead_source = gadget_klass.__template_element
.getElementById("listbox-show-thead-template")
.innerHTML,
listbox_show_thead_template = Handlebars.compile(listbox_show_thead_source),
listbox_hidden_tbody_source = gadget_klass.__template_element
.getElementById("listbox-hidden-tbody-template")
......@@ -348,7 +352,8 @@
.push(function (column_sort_link_list) {
// here we obtain links for sorting by columns
// so we can construct array of header objects to be rendered in the header template
var hide_button_text,
var listbox_thead_template,
hide_button_text,
hide_button_name,
head_value_list = column_list.map(function (column, index) {
var current_sort = sort_list.find(hasSameFirstItem(column)),
......@@ -372,9 +377,11 @@
});
if (gadget.state.show_line_selector) {
listbox_thead_template = listbox_show_thead_template;
hide_button_text = 'Submit';
hide_button_name = 'SelectRows';
} else {
listbox_thead_template = listbox_hidden_thead_template;
hide_button_text = 'Hide Rows';
hide_button_name = 'Hide';
}
......
......@@ -45,8 +45,6 @@
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/clear_query" />
<tr>
<td>waitForElementPresent</td>
......@@ -98,6 +96,7 @@
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>waitForElementPresent</td>
......@@ -113,11 +112,30 @@
<td></td>
</tr>
<!-- Check the listbox column header -->
<tr>
<td>assertText</td>
<td>//thead/tr/th[1]</td>
<td>ID</td>
</tr>
<tr>
<td>assertText</td>
<td>//thead/tr/th[2]</td>
<td>Title</td>
</tr>
<tr>
<td>assertText</td>
<td>//thead/tr/th[3]</td>
<td>Quantity</td>
</tr>
<tr>
<td>click</td>
<td>//button[@data-i18n='Hide Rows']</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tr>
<td>waitForElementPresent</td>
......@@ -125,6 +143,30 @@
<td></td>
</tr>
<!-- Check the listbox column header -->
<tr>
<td>assertText</td>
<td>//thead/tr/th[1]</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//thead/tr/th[2]</td>
<td>ID</td>
</tr>
<tr>
<td>assertText</td>
<td>//thead/tr/th[3]</td>
<td>Title</td>
</tr>
<tr>
<td>assertText</td>
<td>//thead/tr/th[4]</td>
<td>Quantity</td>
</tr>
<!-- Line checkbox -->
<tr>
<td>verifyValue</td>
<td>//tbody/tr/td/input[@type="checkbox"]</td>
......@@ -165,6 +207,23 @@
<td></td>
</tr>
<!-- Check the listbox column header -->
<tr>
<td>assertText</td>
<td>//thead/tr/th[1]</td>
<td>ID</td>
</tr>
<tr>
<td>assertText</td>
<td>//thead/tr/th[2]</td>
<td>Title</td>
</tr>
<tr>
<td>assertText</td>
<td>//thead/tr/th[3]</td>
<td>Quantity</td>
</tr>
<!-- only one element present -->
<tr>
<td>verifyElementPresent</td>
......@@ -191,6 +250,7 @@
<td>//button[@data-i18n='Hide Rows']</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tr>
<td>waitForElementPresent</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