Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
08dfb23b
Commit
08dfb23b
authored
Jul 27, 2017
by
Tomáš Peterka
Committed by
Tomáš Peterka
Jul 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[renderj_ui] Sort Editor shows ONLY correct sort definitions in form of "column | order"
parent
4ba9ad35
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
127 additions
and
122 deletions
+127
-122
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_sorteditor_html.html
...Item/web_page_module/rjs_gadget_erp5_sorteditor_html.html
+2
-7
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_sorteditor_html.xml
...eItem/web_page_module/rjs_gadget_erp5_sorteditor_html.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_sorteditor_js.js
...lateItem/web_page_module/rjs_gadget_erp5_sorteditor_js.js
+12
-8
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_sorteditor_js.xml
...ateItem/web_page_module/rjs_gadget_erp5_sorteditor_js.xml
+2
-2
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_listbox_zuite/testSortDefault.zpt
...ortal_tests/renderjs_ui_listbox_zuite/testSortDefault.zpt
+109
-103
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_sorteditor_html.html
View file @
08dfb23b
...
...
@@ -27,13 +27,8 @@
<
/select
>
<
select
data
-
wrapper
-
class
=
"
ui-input-has-clear
"
data
-
iconpos
=
"
left
"
>
{{
#
equal
operator
"
ascending
"
}}
<
option
selected
=
"
selected
"
data
-
i18n
=
"
ascending
"
value
=
"
ascending
"
>
ascending
<
/option
>
<
option
data
-
i18n
=
"
descending
"
value
=
"
descending
"
>
descending
<
/option
>
{{
else
}}
<
option
data
-
i18n
=
"
ascending
"
value
=
"
ascending
"
>
ascending
<
/option
>
<
option
selected
=
"
selected
"
data
-
i18n
=
"
descending
"
value
=
"
descending
"
>
descending
<
/option
>
{{
/
equal
}}
<
option
{{
#
equal
operator
"
ascending
"
}}
selected
=
"
selected
"
{{
/
equal
}}
data
-
i18n
=
"
ascending
"
value
=
"
ascending
"
>
ascending
<
/option
>
<
option
{{
#
equal
operator
"
descending
"
}}
selected
=
"
selected
"
{{
/
equal
}}
data
-
i18n
=
"
descending
"
value
=
"
descending
"
>
descending
<
/option
>
<
/select
>
<
/div
>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_sorteditor_html.xml
View file @
08dfb23b
...
...
@@ -234,7 +234,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
55.38127.32735.11195
</string>
</value>
<value>
<string>
9
60.64833.40099.37870
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>
1
480342874.92
</float>
<float>
1
501087193.61
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_sorteditor_js.js
View file @
08dfb23b
...
...
@@ -43,6 +43,12 @@
}));
}
/* Valid sort item is a tuple of (column-name, ordering) */
function
isValidSortItem
(
sort_item
)
{
return
sort_item
.
length
===
2
&&
(
sort_item
[
1
]
===
'
ascending
'
||
sort_item
[
1
]
===
'
descending
'
);
}
gadget_klass
//////////////////////////////////////////////
// acquired method
...
...
@@ -58,17 +64,15 @@
return
gadget
.
translateHtml
(
sort_template
())
.
push
(
function
(
translated_html
)
{
var
i
,
promise_list
=
[];
div
.
innerHTML
=
translated_html
;
for
(
i
=
0
;
i
<
gadget
.
state
.
sort_list
.
length
;
i
+=
1
)
{
if
(
gadget
.
state
.
sort_list
[
i
])
{
promise_list
.
push
(
createSortItemTemplate
(
gadget
,
gadget
.
state
.
sort_list
[
i
]));
}
}
return
RSVP
.
all
(
promise_list
);
return
RSVP
.
all
(
gadget
.
state
.
sort_list
.
filter
(
isValidSortItem
)
.
map
(
function
(
sort_item
)
{
return
createSortItemTemplate
(
gadget
,
sort_item
);
})
);
})
.
push
(
function
(
result_list
)
{
var
i
,
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_sorteditor_js.xml
View file @
08dfb23b
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
55.38160.33114.47854
</string>
</value>
<value>
<string>
9
60.64839.39902.53248
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
1
480344058.06
</float>
<float>
1
501087184.97
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_listbox_zuite/testSortDefault.zpt
View file @
08dfb23b
<html
xmlns:tal=
"http://xml.zope.org/namespaces/tal"
xmlns:metal=
"http://xml.zope.org/namespaces/metal"
>
<!--
Ensure default sort is shown on visible columns and in Sort Editor
- default mal-defined sort must not appear neither as an arrow nor in Sort Editor
- correctly defined sorting (ASC and DESC) will appear in both (arrow, editor)
Frontend should not suppose default sorting
-->
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<title>
Test RenderJS UI
</title>
...
...
@@ -11,119 +19,117 @@
</thead><tbody>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplate/macros/init"
/>
<!-- make the listbox to sort by Title DESC which is not the default default now -->
<tr>
<td>
open
</td>
<td>
${base_url}/foo_module/ListBoxZuite_reset?field_sort=title+%7C+DESC
</td>
<!-- ?field_sort="title | DESC" -->
<td></td>
</tr>
<!-- Clean Up -->
<tr><td>
open
</td>
<td>
${base_url}/foo_module/ListBoxZuite_reset
</td><td></td></tr>
<tr><td>
assertTextPresent
</td>
<td>
Reset Successfully.
</td><td></td></tr>
<tr>
<td>
assertTextPresent
</td>
<td>
Reset Successfully.
</td>
<td></td>
</tr>
<!-- Shortcut for full renderjs url -->
<tr><td>
store
</td>
<td>
${base_url}/web_site_module/renderjs_runner
</td>
<td>
renderjs_url
</td></tr>
<!-- Create Foo objects with IDs 0-9 -->
<tr>
<td>
open
</td>
<td>
${base_url}/foo_module/FooModule_createObjects
</td>
<td></td>
</tr>
<tr>
<td>
assertTextPresent
</td>
<td>
Created Successfully.
</td>
<td></td>
</tr>
<tr><td>
open
</td>
<td>
${base_url}/foo_module/FooModule_createObjects
</td><td></td></tr>
<tr><td>
assertTextPresent
</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
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//a[@data-i18n='Title']
</td>
<td></td>
</tr>
<tr>
<td>
verifyElementPresent
</td>
<td>
//th[@class='ui-icon ui-icon-arrow-down']/a[@data-i18n='Title']
</td>
<td></td>
</tr>
<!-- Test whether another sorting condition does keep default sort -->
<tr>
<td>
waitForElementPresent
</td>
<td>
//button[@data-i18n='Sort']
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
//button[@data-i18n='Sort']
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[@class='sort_item_container ui-controlgroup ui-corner_all']/div[1]
</td>
<td></td>
</tr>
<!-- make sure the default sort if visible in "sort editor" -->
<tr>
<td>
verifyValue
</td>
<td>
//div[@class='sort_item_container ui-controlgroup ui-corner_all']/div[1]//select[1]
</td>
<td>
title
</td>
</tr>
<tr>
<td>
verifyValue
</td>
<td>
//div[@class='sort_item_container ui-controlgroup ui-corner_all']/div[1]//select[2]
</td>
<td>
descending
</td>
</tr>
<!-- reset sort and our set up value is the only one to sort by -->
<tr>
<td>
select
</td>
<td>
//div[@class='sort_item_container ui-controlgroup ui-corner_all']/div[1]//select[1]
</td>
<td>
index=0
</td>
<!-- select id -->
</tr>
<tr>
<td>
click
</td>
<td>
//button[@class="submit responsive ui-last-child ui-btn ui-btn-icon-left ui-icon-check"]
</td>
<td></td>
</tr>
<!-- Verify ListBox behaviour with mal-formed sort definition -->
<tr><td>
open
</td>
<td>
${renderjs_url}/#/foo_module
</td><td></td></tr>
<tr><td>
waitForElementPresent
</td>
<td>
//a[@data-i18n='ID']
</td><td></td></tr>
<!-- No default sort must be shown because the definition is broken "id | id" -->
<tr><td>
verifyElementPresent
</td>
<td>
//th[@class='']/a[@data-i18n='ID']
</td><td></td></tr>
<!-- Make sure broken definitions don't appear in sort editor -->
<tr><td>
waitForElementPresent
</td>
<td>
//button[@data-i18n='Sort']
</td><td></td></tr>
<tr><td>
click
</td>
<td>
//button[@data-i18n='Sort']
</td><td></td></tr>
<tr><td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-url='${renderjs_url}/gadget_erp5_sort_editor.html']//button[@class="plus ui-btn-c ui-override-theme ui-btn ui-icon-plus ui-btn-icon-left ui-corner-all"]
</td><td></td></tr>
<tr><td>
verifyElementNotPresent
</td>
<td>
//div[@data-gadget-url='${renderjs_url}/gadget_erp5_sort_editor.html']//select
</td><td></td></tr>
<!-- Let's set up the default sort correctly: id | ASC -->
<tr><td>
open
</td>
<td>
${base_url}/FooModule_viewFooList/listbox/ListBox_setPropertyList?field_sort=id+%7C+ASC
</td><td></td></tr>
<tr><td>
assertTextPresent
</td>
<td>
Set Successfully.
</td><td></td></tr>
<!-- Verify ListBox behaviour with valid ASC sort configuration -->
<tr><td>
open
</td>
<td>
${renderjs_url}//#/foo_module
</td><td></td></tr>
<tr><td>
waitForElementPresent
</td>
<td>
//a[@data-i18n='ID']
</td><td></td></tr>
<!-- Default sort on ID column has to be ASCENDING -->
<tr><td>
verifyElementPresent
</td>
<td>
//th[@class='ui-icon ui-icon-arrow-up']/a[@data-i18n='ID']
</td><td></td></tr>
<!-- Verify that the default sort is visible in Sort Editor -->
<tr><td>
waitForElementPresent
</td>
<td>
//button[@data-i18n='Sort']
</td><td></td></tr>
<tr><td>
click
</td>
<td>
//button[@data-i18n='Sort']
</td><td></td></tr>
<tr><td>
waitForElementPresent
</td>
<td>
//div[@class='sort_item_container ui-controlgroup ui-corner_all']/div[1]
</td><td></td></tr>
<tr><td>
verifyValue
</td>
<td>
//div[@class='sort_item_container ui-controlgroup ui-corner_all']/div[1]//select[1]
</td>
<td>
id
</td></tr>
<tr><td>
verifyValue
</td>
<td>
//div[@class='sort_item_container ui-controlgroup ui-corner_all']/div[1]//select[2]
</td>
<td>
ascending
</td></tr>
<!-- Let's set up the default sort correctly: title | DESC -->
<tr><td>
open
</td>
<td>
${base_url}/FooModule_viewFooList/listbox/ListBox_setPropertyList?field_sort=title+%7C+DESC
</td><td></td></tr>
<tr><td>
assertTextPresent
</td>
<td>
Set Successfully.
</td><td></td></tr>
<!-- Verify ListBox behaviour with valid DESC sort configuration -->
<tr><td>
open
</td>
<td>
${renderjs_url}/#/foo_module
</td><td></td></tr>
<tr><td>
waitForElementPresent
</td>
<td>
//a[@data-i18n='Title']
</td><td></td></tr>
<!-- Default sort on Title column has to be DESCENDING -->
<tr><td>
verifyElementPresent
</td>
<td>
//th[@class='ui-icon ui-icon-arrow-down']/a[@data-i18n='Title']
</td><td></td></tr>
<!-- No other sort must be shown -->
<tr><td>
verifyElementPresent
</td>
<td>
//th[@class='']/a[@data-i18n='ID']
</td><td></td></tr>
<!-- Verify that the default sort is visible in Sort Editor -->
<tr><td>
waitForElementPresent
</td>
<td>
//button[@data-i18n='Sort']
</td><td></td></tr>
<tr><td>
click
</td>
<td>
//button[@data-i18n='Sort']
</td><td></td></tr>
<tr><td>
waitForElementPresent
</td>
<td>
//div[@class='sort_item_container ui-controlgroup ui-corner_all']/div[1]
</td><td></td></tr>
<tr><td>
verifyValue
</td>
<td>
//div[@class='sort_item_container ui-controlgroup ui-corner_all']/div[1]//select[1]
</td>
<td>
title
</td></tr>
<tr><td>
verifyValue
</td>
<td>
//div[@class='sort_item_container ui-controlgroup ui-corner_all']/div[1]//select[2]
</td>
<td>
descending
</td></tr>
<!-- Change sort using the Sort Editor -->
<tr><td>
select
</td>
<td>
//div[@class='sort_item_container ui-controlgroup ui-corner_all']/div[1]//select[1]
</td>
<td>
index=0
</td>
<!-- select ID -->
</tr>
<tr><td>
click
</td>
<td>
//button[@class="submit responsive ui-last-child ui-btn ui-btn-icon-left ui-icon-check"]
</td><td></td></tr>
<!-- Wait for the Filters to be applied -->
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded"
/>
<!-- Check that default sort arrow disappeared -->
<tr>
<td>
verifyElementNotPresent
</td>
<td>
//th[@class='ui-icon ui-icon-arrow-up']/a[@data-i18n='Title']
</td>
<td></td>
</tr>
<tr>
<td>
verifyElementNotPresent
</td>
<td>
//th[@class='ui-icon ui-icon-arrow-up']/a[@data-i18n='ID']
</td>
<td></td>
</tr>
<tr>
<td>
verifyElementPresent
</td>
<td>
//th[@class='ui-icon ui-icon-arrow-down']/a[@data-i18n='ID']
</td>
<td></td>
</tr>
<!-- Verify that default sort arrow disappeared -->
<tr><td>
verifyElementPresent
</td>
<td>
//th[@class='']/a[@data-i18n='Title']
</td><td></td></tr>
<tr><td>
verifyElementPresent
</td>
<td>
//th[@class='ui-icon ui-icon-arrow-down']/a[@data-i18n='ID']
</td><td></td></tr>
</tbody></table>
</body>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment