Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
fcf99d0d
Commit
fcf99d0d
authored
Oct 07, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check originalEvent.repeat
parent
f96c6c43
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
app/assets/javascripts/behaviors/quick_submit.js.coffee
app/assets/javascripts/behaviors/quick_submit.js.coffee
+1
-1
spec/javascripts/behaviors/quick_submit_spec.js.coffee
spec/javascripts/behaviors/quick_submit_spec.js.coffee
+9
-1
No files found.
app/assets/javascripts/behaviors/quick_submit.js.coffee
View file @
fcf99d0d
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
# </form>
# </form>
#
#
$
(
document
).
on
'keydown.quick_submit'
,
'.js-quick-submit'
,
(
e
)
->
$
(
document
).
on
'keydown.quick_submit'
,
'.js-quick-submit'
,
(
e
)
->
return
if
e
.
repeat
return
if
e
.
originalEvent
.
repeat
return
unless
e
.
keyCode
==
13
# Enter
return
unless
e
.
keyCode
==
13
# Enter
if
navigator
.
userAgent
.
match
(
/Macintosh/
)
if
navigator
.
userAgent
.
match
(
/Macintosh/
)
...
...
spec/javascripts/behaviors/quick_submit_spec.js.coffee
View file @
fcf99d0d
...
@@ -23,6 +23,11 @@ describe 'Quick Submit behavior', ->
...
@@ -23,6 +23,11 @@ describe 'Quick Submit behavior', ->
expect
(
@
spies
.
submit
).
not
.
toHaveBeenTriggered
()
expect
(
@
spies
.
submit
).
not
.
toHaveBeenTriggered
()
it
'does not respond to repeated events'
,
->
$
(
'input'
).
trigger
(
keydownEvent
(
repeat
:
true
))
expect
(
@
spies
.
submit
).
not
.
toHaveBeenTriggered
()
it
'disables submit buttons'
,
->
it
'disables submit buttons'
,
->
$
(
'textarea'
).
trigger
(
keydownEvent
())
$
(
'textarea'
).
trigger
(
keydownEvent
())
...
@@ -62,4 +67,7 @@ describe 'Quick Submit behavior', ->
...
@@ -62,4 +67,7 @@ describe 'Quick Submit behavior', ->
else
else
defaults
=
{
keyCode
:
13
,
ctrlKey
:
true
}
defaults
=
{
keyCode
:
13
,
ctrlKey
:
true
}
$
.
Event
(
'keydown'
,
$
.
extend
({},
defaults
,
options
))
args
=
$
.
extend
({},
defaults
,
options
)
originalEvent
=
new
KeyboardEvent
(
'keydown'
,
args
)
$
.
Event
(
'keydown'
,
$
.
extend
({},
args
,
{
originalEvent
:
originalEvent
}))
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