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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d4317e4d
Commit
d4317e4d
authored
Feb 09, 2017
by
winniehell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use textarea for quick submit spec
parent
8a1441fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
+15
-14
spec/javascripts/behaviors/quick_submit_spec.js
spec/javascripts/behaviors/quick_submit_spec.js
+15
-13
spec/javascripts/fixtures/behaviors/quick_submit.html.haml
spec/javascripts/fixtures/behaviors/quick_submit.html.haml
+0
-1
No files found.
spec/javascripts/behaviors/quick_submit_spec.js
View file @
d4317e4d
...
...
@@ -12,31 +12,33 @@ require('~/behaviors/quick_submit');
// Prevent a form submit from moving us off the testing page
return
e
.
preventDefault
();
});
return
this
.
spies
=
{
this
.
spies
=
{
submit
:
spyOnEvent
(
'
form
'
,
'
submit
'
)
};
this
.
textarea
=
$
(
'
.js-quick-submit textarea
'
).
first
();
});
it
(
'
does not respond to other keyCodes
'
,
function
()
{
$
(
'
input.quick-submit-input
'
)
.
trigger
(
keydownEvent
({
this
.
textarea
.
trigger
(
keydownEvent
({
keyCode
:
32
}));
return
expect
(
this
.
spies
.
submit
).
not
.
toHaveBeenTriggered
();
});
it
(
'
does not respond to Enter alone
'
,
function
()
{
$
(
'
input.quick-submit-input
'
)
.
trigger
(
keydownEvent
({
this
.
textarea
.
trigger
(
keydownEvent
({
ctrlKey
:
false
,
metaKey
:
false
}));
return
expect
(
this
.
spies
.
submit
).
not
.
toHaveBeenTriggered
();
});
it
(
'
does not respond to repeated events
'
,
function
()
{
$
(
'
input.quick-submit-input
'
)
.
trigger
(
keydownEvent
({
this
.
textarea
.
trigger
(
keydownEvent
({
repeat
:
true
}));
return
expect
(
this
.
spies
.
submit
).
not
.
toHaveBeenTriggered
();
});
it
(
'
disables submit buttons
'
,
function
()
{
$
(
'
textarea
'
)
.
trigger
(
keydownEvent
());
this
.
textarea
.
trigger
(
keydownEvent
());
expect
(
$
(
'
input[type=submit]
'
)).
toBeDisabled
();
return
expect
(
$
(
'
button[type=submit]
'
)).
toBeDisabled
();
});
...
...
@@ -44,34 +46,34 @@ require('~/behaviors/quick_submit');
// only run the tests that apply to the current platform
if
(
navigator
.
userAgent
.
match
(
/Macintosh/
))
{
it
(
'
responds to Meta+Enter
'
,
function
()
{
$
(
'
input.quick-submit-input
'
)
.
trigger
(
keydownEvent
());
this
.
textarea
.
trigger
(
keydownEvent
());
return
expect
(
this
.
spies
.
submit
).
toHaveBeenTriggered
();
});
it
(
'
excludes other modifier keys
'
,
function
()
{
$
(
'
input.quick-submit-input
'
)
.
trigger
(
keydownEvent
({
this
.
textarea
.
trigger
(
keydownEvent
({
altKey
:
true
}));
$
(
'
input.quick-submit-input
'
)
.
trigger
(
keydownEvent
({
this
.
textarea
.
trigger
(
keydownEvent
({
ctrlKey
:
true
}));
$
(
'
input.quick-submit-input
'
)
.
trigger
(
keydownEvent
({
this
.
textarea
.
trigger
(
keydownEvent
({
shiftKey
:
true
}));
return
expect
(
this
.
spies
.
submit
).
not
.
toHaveBeenTriggered
();
});
}
else
{
it
(
'
responds to Ctrl+Enter
'
,
function
()
{
$
(
'
input.quick-submit-input
'
)
.
trigger
(
keydownEvent
());
this
.
textarea
.
trigger
(
keydownEvent
());
return
expect
(
this
.
spies
.
submit
).
toHaveBeenTriggered
();
});
it
(
'
excludes other modifier keys
'
,
function
()
{
$
(
'
input.quick-submit-input
'
)
.
trigger
(
keydownEvent
({
this
.
textarea
.
trigger
(
keydownEvent
({
altKey
:
true
}));
$
(
'
input.quick-submit-input
'
)
.
trigger
(
keydownEvent
({
this
.
textarea
.
trigger
(
keydownEvent
({
metaKey
:
true
}));
$
(
'
input.quick-submit-input
'
)
.
trigger
(
keydownEvent
({
this
.
textarea
.
trigger
(
keydownEvent
({
shiftKey
:
true
}));
return
expect
(
this
.
spies
.
submit
).
not
.
toHaveBeenTriggered
();
...
...
spec/javascripts/fixtures/behaviors/quick_submit.html.haml
View file @
d4317e4d
%form
.js-quick-submit
{
action:
'/foo'
}
%input
{
type:
'text'
,
class:
'quick-submit-input'
}
%textarea
%input
{
type:
'submit'
}
Submit
...
...
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