BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e5f446b7
Commit
e5f446b7
authored
Feb 13, 2017
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'quick-submit-fixture' into 'master'
Replace static fixture for behaviors/quick_submit_spec.js See merge request !9086
parents
828776ed
128d8b61
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
24 deletions
+32
-24
quick-submit-fixture.yml
changelogs/unreleased/quick-submit-fixture.yml
+4
-0
quick_submit_spec.js
spec/javascripts/behaviors/quick_submit_spec.js
+28
-18
quick_submit.html.haml
spec/javascripts/fixtures/behaviors/quick_submit.html.haml
+0
-6
No files found.
changelogs/unreleased/quick-submit-fixture.yml
0 → 100644
View file @
e5f446b7
---
title
:
Replace static fixture for behaviors/quick_submit_spec.js
merge_request
:
9086
author
:
winniehell
spec/javascripts/behaviors/quick_submit_spec.js
View file @
e5f446b7
...
...
@@ -5,73 +5,83 @@ require('~/behaviors/quick_submit');
(
function
()
{
describe
(
'Quick Submit behavior'
,
function
()
{
var
keydownEvent
;
preloadFixtures
(
'
static/behaviors/quick_submit
.html.raw'
);
preloadFixtures
(
'
issues/open-issue
.html.raw'
);
beforeEach
(
function
()
{
loadFixtures
(
'
static/behaviors/quick_submit
.html.raw'
);
loadFixtures
(
'
issues/open-issue
.html.raw'
);
$
(
'form'
).
submit
(
function
(
e
)
{
// 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
());
expect
(
$
(
'input[type=submit]'
)).
toBeDisabled
();
return
expect
(
$
(
'button[type=submit]'
)).
toBeDisabled
();
it
(
'disables input of type submit'
,
function
()
{
const
submitButton
=
$
(
'.js-quick-submit input[type=submit]'
);
this
.
textarea
.
trigger
(
keydownEvent
());
expect
(
submitButton
).
toBeDisabled
();
});
it
(
'disables button of type submit'
,
function
()
{
// button doesn't exist in fixture, add it manually
const
submitButton
=
$
(
'<button type="submit">Submit it</button>'
);
submitButton
.
insertAfter
(
this
.
textarea
);
this
.
textarea
.
trigger
(
keydownEvent
());
expect
(
submitButton
).
toBeDisabled
();
});
// We cannot stub `navigator.userAgent` for CI's `rake karma` task, so we'll
// 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
deleted
100644 → 0
View file @
828776ed
%form
.js-quick-submit
{
action:
'/foo'
}
%input
{
type:
'text'
,
class:
'quick-submit-input'
}
%textarea
%input
{
type:
'submit'
}
Submit
%button
.btn
{
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