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
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
bd496b38
Commit
bd496b38
authored
Oct 19, 2018
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
officejs_support_request_ui: prevent submitting comment twice
parent
a5afdfae
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
229 additions
and
7 deletions
+229
-7
bt5/erp5_officejs_support_request_ui/PathTemplateItem/web_page_module/gadget_supportrequest_pt_form_view_discussable_js.js
...dule/gadget_supportrequest_pt_form_view_discussable_js.js
+13
-6
bt5/erp5_officejs_support_request_ui/PathTemplateItem/web_page_module/gadget_supportrequest_pt_form_view_discussable_js.xml
...ule/gadget_supportrequest_pt_form_view_discussable_js.xml
+1
-1
bt5/erp5_officejs_support_request_ui_test/PathTemplateItem/portal_tests/officejs_support_request_ui_zuite/testDoubleSubmitComment.xml
...cejs_support_request_ui_zuite/testDoubleSubmitComment.xml
+58
-0
bt5/erp5_officejs_support_request_ui_test/PathTemplateItem/portal_tests/officejs_support_request_ui_zuite/testDoubleSubmitComment.zpt
...cejs_support_request_ui_zuite/testDoubleSubmitComment.zpt
+157
-0
No files found.
bt5/erp5_officejs_support_request_ui/PathTemplateItem/web_page_module/gadget_supportrequest_pt_form_view_discussable_js.js
View file @
bd496b38
...
@@ -218,8 +218,11 @@
...
@@ -218,8 +218,11 @@
submitButton
=
gadget
.
element
.
querySelector
(
"
input[type=submit]
"
);
submitButton
=
gadget
.
element
.
querySelector
(
"
input[type=submit]
"
);
submitButton
.
disabled
=
true
;
submitButton
.
disabled
=
true
;
submitButton
.
classList
.
add
(
"
ui-disabled
"
);
function
enableSubmitButton
()
{
function
enableSubmitButton
()
{
submitButton
.
disabled
=
false
;
submitButton
.
disabled
=
false
;
submitButton
.
classList
.
remove
(
"
ui-disabled
"
);
}
}
queue
=
gadget
.
notifySubmitted
({
message
:
"
Posting comment
"
})
queue
=
gadget
.
notifySubmitted
({
message
:
"
Posting comment
"
})
.
push
(
function
()
{
.
push
(
function
()
{
...
@@ -231,6 +234,10 @@
...
@@ -231,6 +234,10 @@
data
.
append
(
"
predecessor
"
,
''
);
data
.
append
(
"
predecessor
"
,
''
);
data
.
append
(
"
data
"
,
content
.
comment
);
data
.
append
(
"
data
"
,
content
.
comment
);
data
.
append
(
"
file
"
,
file_blob
);
data
.
append
(
"
file
"
,
file_blob
);
// reset the file upload, otherwise next comment would upload same file again
choose_file_html_element
.
value
=
""
;
// XXX: Hack, call jIO.util.ajax directly to pass the file blob
// XXX: Hack, call jIO.util.ajax directly to pass the file blob
// Because the jio_putAttachment will call readBlobAsText, which
// Because the jio_putAttachment will call readBlobAsText, which
// will broke the binary file. Call the jIO.util.ajax directly
// will broke the binary file. Call the jIO.util.ajax directly
...
@@ -248,12 +255,12 @@
...
@@ -248,12 +255,12 @@
return
gadget
.
notifySubmitted
({
message
:
"
Comment added
"
,
status
:
"
success
"
});
return
gadget
.
notifySubmitted
({
message
:
"
Comment added
"
,
status
:
"
success
"
});
})
})
.
push
(
function
()
{
.
push
(
function
()
{
editor
.
changeState
({
value
:
''
})
return
editor
.
changeState
({
value
:
''
});
})
.
push
(
function
()
{
.
push
(
function
()
{
return
gadget
.
redirect
({
command
:
'
reload
'
});
return
gadget
.
redirect
({
command
:
'
reload
'
});
});
})
});
.
push
(
enableSubmitButton
,
enableSubmitButton
);
queue
.
push
(
enableSubmitButton
,
enableSubmitButton
);
return
queue
;
return
queue
;
});
});
})
})
...
...
bt5/erp5_officejs_support_request_ui/PathTemplateItem/web_page_module/gadget_supportrequest_pt_form_view_discussable_js.xml
View file @
bd496b38
...
@@ -252,7 +252,7 @@
...
@@ -252,7 +252,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15399
39405.65
</float>
<float>
15399
46621.33
</float>
<string>
GMT+9
</string>
<string>
GMT+9
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs_support_request_ui_test/PathTemplateItem/portal_tests/officejs_support_request_ui_zuite/testDoubleSubmitComment.xml
0 → 100644
View file @
bd496b38
<?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>
testDoubleSubmitComment
</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_officejs_support_request_ui_test/PathTemplateItem/portal_tests/officejs_support_request_ui_zuite/testDoubleSubmitComment.zpt
0 → 100644
View file @
bd496b38
<html>
<head>
<title
tal:content=
"template/title_or_id"
>
The title
</title>
<meta
http-equiv=
"content-type"
content=
"text/html;charset=utf-8"
>
</head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
<tr><td
rowspan=
"1"
colspan=
"3"
>
Support Request Zuite
</td></tr>
</thead><tbody>
<tal:block
metal:use-macro=
"here/Zuite_SupportRequestUITemplate/macros/init"
/>
<tr>
<td>
open
</td>
<td>
${base_url}/web_site_module/erp5_officejs_support_request_ui/
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//input[@data-i18n='[value]Submit New Support Request']
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
//input[@data-i18n='[value]Submit New Support Request']
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//input[@data-i18n="[value]Proceed"]
</td>
<td></td>
</tr>
<tr>
<td>
type
</td>
<td>
//input[@name='field_your_title']
</td>
<td>
test
</td>
</tr>
<tr>
<td>
select
</td>
<td>
field_your_project
</td>
<td>
RobotMaking
</td>
</tr>
<tr>
<td>
waitForTextPresent
</td>
<td>
FeatureRequire
</td>
<td></td>
</tr>
<tr>
<td>
select
</td>
<td>
field_your_resource
</td>
<td>
FeatureRequire
</td>
</tr>
<tal:block
tal:define=
"text_content string:First Post Content"
>
<tal:block
metal:use-macro=
"container/Zuite_CommonTemplateForRenderjsUi/macros/type_ckeditor_text_content"
/>
</tal:block>
<tr>
<td>
waitForElementPresent
</td>
<td>
//input[@data-i18n='[value]Proceed']
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
//input[@data-i18n='[value]Proceed']
</td>
<td></td>
</tr>
<tr>
<td>
waitForText
</td>
<td>
//ol[@id="post_list"]//li[1]/p
</td>
<td>
First Post Content
</td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//input[@data-i18n="[value]Post Comment"]
</td>
<td></td>
</tr>
<tal:block
tal:define=
"text_content string:Second Post Content"
>
<tal:block
metal:use-macro=
"container/Zuite_CommonTemplateForRenderjsUi/macros/type_ckeditor_text_content"
/>
</tal:block>
<tr>
<td>
click
</td>
<td>
//input[@data-i18n='[value]Post Comment']
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//input[@data-i18n='[value]Post Comment' and @disabled and contains(@class, "ui-disabled")]
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
//input[@data-i18n='[value]Post Comment']
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
//input[@data-i18n='[value]Post Comment']
</td>
<td></td>
</tr>
<tal:block
tal:define=
"notification_configuration python: {'class': 'success',
'text': 'Comment added'}"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification"
/>
</tal:block>
<tr>
<td>
click
</td>
<td>
//input[@data-i18n='[value]Post Comment']
</td>
<td></td>
</tr>
<tal:block
tal:define=
"notification_configuration python: {'class': 'error',
'text': 'Post content can not be empty!'}"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification"
/>
</tal:block>
<tr>
<td>
store
</td>
<td>
javascript{selenium.browserbot.getCurrentWindow().location.href}
</td>
<td>
current_location
</td>
</tr>
<tr>
<td>
open
</td>
<td
tal:content=
"string:${here/portal_url}/Zuite_waitForActivities"
/>
<td/>
</tr>
<tr>
<td>
waitForTextPresent
</td>
<td>
Done.
</td>
<td/>
</tr>
<tr>
<td>
open
</td>
<td>
${current_location}
</td>
<td></td>
</tr>
<!-- The second post was submitted only once. -->
<tr>
<td>
waitForText
</td>
<td>
//ol[@id="post_list"]//li[1]/p
</td>
<td>
First Post Content
</td>
</tr>
<tr>
<td>
waitForText
</td>
<td>
//ol[@id="post_list"]//li[2]/p
</td>
<td>
Second Post Content
</td>
</tr>
<tr>
<td>
assertElementNotPresent
</td>
<td>
//ol[@id="post_list"]//li[3]/p
</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
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