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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Titouan Soulard
erp5
Commits
7c0f804d
Commit
7c0f804d
authored
Jun 10, 2019
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Validate dialog before posting it to the server
parent
d751567a
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
217 additions
and
75 deletions
+217
-75
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewCustomWorkflowRequiredActionDialog/your_custom_workflow_variable.xml
...lowRequiredActionDialog/your_custom_workflow_variable.xml
+1
-1
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
...Item/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
+73
-66
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
...tem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
+2
-2
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_page_templates_zuite/testFormDialogWorkflowValidationErrorBackend.xml
...es_zuite/testFormDialogWorkflowValidationErrorBackend.xml
+1
-1
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_page_templates_zuite/testFormDialogWorkflowValidationErrorBackend.zpt
...es_zuite/testFormDialogWorkflowValidationErrorBackend.zpt
+79
-0
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_page_templates_zuite/testFormDialogWorkflowValidationErrorFrontend.xml
...s_zuite/testFormDialogWorkflowValidationErrorFrontend.xml
+58
-0
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_page_templates_zuite/testFormDialogWorkflowValidationErrorFrontend.zpt
...s_zuite/testFormDialogWorkflowValidationErrorFrontend.zpt
+3
-5
No files found.
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewCustomWorkflowRequiredActionDialog/your_custom_workflow_variable.xml
View file @
7c0f804d
...
@@ -233,7 +233,7 @@
...
@@ -233,7 +233,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
max_length
</string>
</key>
<key>
<string>
max_length
</string>
</key>
<value>
<
string></string
>
</value>
<value>
<
int>
50
</int
>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
required
</string>
</key>
<key>
<string>
required
</string>
</key>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
View file @
7c0f804d
...
@@ -35,7 +35,13 @@
...
@@ -35,7 +35,13 @@
}
}
}
}
return
getContent
.
apply
(
this
)
return
checkValidity
.
apply
(
gadget
)
.
push
(
function
(
is_valid
)
{
if
(
!
is_valid
)
{
enableButton
();
return
;
}
return
getContent
.
apply
(
gadget
)
.
push
(
function
(
content_dict
)
{
.
push
(
function
(
content_dict
)
{
var
data
=
{},
var
data
=
{},
key
;
key
;
...
@@ -106,6 +112,7 @@
...
@@ -106,6 +112,7 @@
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
enableButton
();
enableButton
();
return
result
;
return
result
;
});
},
function
(
error
)
{
},
function
(
error
)
{
enableButton
();
enableButton
();
throw
error
;
throw
error
;
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
View file @
7c0f804d
...
@@ -222,7 +222,7 @@
...
@@ -222,7 +222,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
97
2.55890.2478.15121
</string>
</value>
<value>
<string>
97
6.20956.15292.37495
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -240,7 +240,7 @@
...
@@ -240,7 +240,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15
47136935.14
</float>
<float>
15
60246152.37
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_page_templates_zuite/testFormDialogWorkflow
Error
.xml
→
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_page_templates_zuite/testFormDialogWorkflow
ValidationErrorBackend
.xml
View file @
7c0f804d
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
testFormDialogWorkflow
Error
</string>
</value>
<value>
<string>
testFormDialogWorkflow
ValidationErrorBackend
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<key>
<string>
output_encoding
</string>
</key>
...
...
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_page_templates_zuite/testFormDialogWorkflowValidationErrorBackend.zpt
0 → 100644
View file @
7c0f804d
<html
xmlns:tal=
"http://xml.zope.org/namespaces/tal"
xmlns:metal=
"http://xml.zope.org/namespaces/metal"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<title>
Test Workflow Transition with Invalid Form
</title>
</head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
<tr><td
rowspan=
"1"
colspan=
"3"
>
Test Workflow Transition with Invalid Form
</td></tr>
</thead><tbody>
<tal:block
metal:use-macro=
"here/PTZuite_CommonTemplate/macros/init"
/>
<tr>
<td>
open
</td>
<td>
${base_url}/web_site_module/renderjs_runner/#/foo_module/1?editable=1
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//a[text()='Actions']
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
//a[text()='Actions']
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//a[@data-i18n='Custom Required Dialog']
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
//a[@data-i18n='Custom Required Dialog']
</td>
<td></td>
</tr>
<!-- Wait for gadget to be loaded -->
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded"
/>
<tr>
<td>
assertElementPresent
</td>
<td>
//input[@name='field_your_custom_workflow_variable']
</td>
<td></td>
</tr>
<tr>
<td>
type
</td>
<td>
//input[@name='field_your_custom_workflow_variable']
</td>
<td>
AZERTYUIOPQSDFGHJKLMWXCVBNazertyuiopqsdfghjklmwxcvbn
</td>
</tr>
<!-- Fill long string to provoke form validation failure -->
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog"
/>
<tal:block
tal:define=
"notification_configuration python: {'class': 'error', 'text': 'Input data has errors.'}"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification"
/>
</tal:block>
<tr><td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-scope="field_your_custom_workflow_variable"]/div/span
</td><td></td></tr>
<tr><td>
assertText
</td>
<td>
//div[@data-gadget-scope="field_your_custom_workflow_variable"]/div/span
</td>
<td>
Too much input was given.
</td></tr>
<tr><td>
type
</td>
<td>
//textarea[@name='field_your_comment']
</td>
<td>
QWERTY
</td></tr>
<tr><td>
type
</td>
<td>
//input[@name='field_your_custom_workflow_variable']
</td>
<td>
YTREWQ
</td></tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog"
/>
<!-- Wait for the notification to appear. We cannot use verifyText because the button
is there all the time. It gets text assigned and is shown asynchronously later. -->
<tal:block
tal:define=
"notification_configuration python: {'class': 'success', 'text': 'Status changed.'}"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification"
/>
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_page_templates_zuite/testFormDialogWorkflowValidationErrorFrontend.xml
0 → 100644
View file @
7c0f804d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
testFormDialogWorkflowValidationErrorFrontend
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
utf-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_page_templates_zuite/testFormDialogWorkflow
Error
.zpt
→
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_page_templates_zuite/testFormDialogWorkflow
ValidationErrorFrontend
.zpt
View file @
7c0f804d
...
@@ -36,21 +36,19 @@
...
@@ -36,21 +36,19 @@
<td></td>
<td></td>
</tr>
</tr>
<!-- Wait for gadget to be loaded -->
<!-- Wait for gadget to be loaded -->
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded"
/>
<tr>
<tr>
<td>
waitFor
ElementPresent
</td>
<td>
assert
ElementPresent
</td>
<td>
//input[@name='field_your_custom_workflow_variable']
</td>
<td>
//input[@name='field_your_custom_workflow_variable']
</td>
<td></td>
<td></td>
</tr>
</tr>
<!-- Do not fill anything to provoke form validation failure -->
<!-- Do not fill anything to provoke form validation failure -->
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog"
/>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog"
/>
<tal:block
tal:define=
"notification_configuration python: {'class': 'error', 'text': 'Input data has errors.'}"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification"
/>
</tal:block>
<tr><td>
waitForElementPresent
</td>
<tr><td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-scope="field_your_custom_workflow_variable"]/div/span
</td><td></td></tr>
<td>
//div[@data-gadget-scope="field_your_custom_workflow_variable"]/div/span
</td><td></td></tr>
<tr><td>
assertText
</td>
<tr><td>
assertText
</td>
<td>
//div[@data-gadget-scope="field_your_custom_workflow_variable"]/div/span
</td>
<td>
//div[@data-gadget-scope="field_your_custom_workflow_variable"]/div/span
</td>
<td>
Input is required but no input given
.
</td></tr>
<td>
Please fill out this field
.
</td></tr>
<tr><td>
type
</td>
<tr><td>
type
</td>
<td>
//textarea[@name='field_your_comment']
</td>
<td>
//textarea[@name='field_your_comment']
</td>
...
...
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