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
Jérome Perrin
gitlab-ce
Commits
6d4e8154
Commit
6d4e8154
authored
Jun 23, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes ctrl+enter not submit issue edit form
Closes #33758
parent
801cf923
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
2 deletions
+58
-2
app/assets/javascripts/issue_show/components/fields/description.vue
.../javascripts/issue_show/components/fields/description.vue
+2
-1
app/assets/javascripts/issue_show/components/fields/title.vue
...assets/javascripts/issue_show/components/fields/title.vue
+2
-1
changelogs/unreleased/issue-inline-edit-quick-submit.yml
changelogs/unreleased/issue-inline-edit-quick-submit.yml
+4
-0
spec/javascripts/issue_show/components/fields/description_spec.js
...ascripts/issue_show/components/fields/description_spec.js
+20
-0
spec/javascripts/issue_show/components/fields/title_spec.js
spec/javascripts/issue_show/components/fields/title_spec.js
+20
-0
spec/javascripts/issue_show/helpers.js
spec/javascripts/issue_show/helpers.js
+10
-0
No files found.
app/assets/javascripts/issue_show/components/fields/description.vue
View file @
6d4e8154
...
@@ -47,7 +47,8 @@
...
@@ -47,7 +47,8 @@
ref=
"textarea"
ref=
"textarea"
slot=
"textarea"
slot=
"textarea"
placeholder=
"Write a comment or drag your files here..."
placeholder=
"Write a comment or drag your files here..."
@
keydown.meta.enter=
"updateIssuable"
>
@
keydown.meta.enter=
"updateIssuable"
@
keydown.ctrl.enter=
"updateIssuable"
>
</textarea>
</textarea>
</markdown-field>
</markdown-field>
</div>
</div>
...
...
app/assets/javascripts/issue_show/components/fields/title.vue
View file @
6d4e8154
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
placeholder=
"Issue title"
placeholder=
"Issue title"
aria-label=
"Issue title"
aria-label=
"Issue title"
v-model=
"formState.title"
v-model=
"formState.title"
@
keydown.meta.enter=
"updateIssuable"
/>
@
keydown.meta.enter=
"updateIssuable"
@
keydown.ctrl.enter=
"updateIssuable"
/>
</fieldset>
</fieldset>
</
template
>
</
template
>
changelogs/unreleased/issue-inline-edit-quick-submit.yml
0 → 100644
View file @
6d4e8154
---
title
:
Fixed ctrl+enter not submit issue edit form
merge_request
:
author
:
spec/javascripts/issue_show/components/fields/description_spec.js
View file @
6d4e8154
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
eventHub
from
'
~/issue_show/event_hub
'
;
import
Store
from
'
~/issue_show/stores
'
;
import
Store
from
'
~/issue_show/stores
'
;
import
descriptionField
from
'
~/issue_show/components/fields/description.vue
'
;
import
descriptionField
from
'
~/issue_show/components/fields/description.vue
'
;
import
{
keyboardDownEvent
}
from
'
../../helpers
'
;
describe
(
'
Description field component
'
,
()
=>
{
describe
(
'
Description field component
'
,
()
=>
{
let
vm
;
let
vm
;
...
@@ -18,6 +20,8 @@ describe('Description field component', () => {
...
@@ -18,6 +20,8 @@ describe('Description field component', () => {
document
.
body
.
appendChild
(
el
);
document
.
body
.
appendChild
(
el
);
spyOn
(
eventHub
,
'
$emit
'
);
vm
=
new
Component
({
vm
=
new
Component
({
el
,
el
,
propsData
:
{
propsData
:
{
...
@@ -53,4 +57,20 @@ describe('Description field component', () => {
...
@@ -53,4 +57,20 @@ describe('Description field component', () => {
document
.
activeElement
,
document
.
activeElement
,
).
toBe
(
vm
.
$refs
.
textarea
);
).
toBe
(
vm
.
$refs
.
textarea
);
});
});
it
(
'
triggers update with meta+enter
'
,
()
=>
{
vm
.
$el
.
querySelector
(
'
.md-area textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
true
));
expect
(
eventHub
.
$emit
,
).
toHaveBeenCalled
();
});
it
(
'
triggers update with ctrl+enter
'
,
()
=>
{
vm
.
$el
.
querySelector
(
'
.md-area textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
false
,
true
));
expect
(
eventHub
.
$emit
,
).
toHaveBeenCalled
();
});
});
});
spec/javascripts/issue_show/components/fields/title_spec.js
View file @
6d4e8154
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
eventHub
from
'
~/issue_show/event_hub
'
;
import
Store
from
'
~/issue_show/stores
'
;
import
Store
from
'
~/issue_show/stores
'
;
import
titleField
from
'
~/issue_show/components/fields/title.vue
'
;
import
titleField
from
'
~/issue_show/components/fields/title.vue
'
;
import
{
keyboardDownEvent
}
from
'
../../helpers
'
;
describe
(
'
Title field component
'
,
()
=>
{
describe
(
'
Title field component
'
,
()
=>
{
let
vm
;
let
vm
;
...
@@ -15,6 +17,8 @@ describe('Title field component', () => {
...
@@ -15,6 +17,8 @@ describe('Title field component', () => {
});
});
store
.
formState
.
title
=
'
test
'
;
store
.
formState
.
title
=
'
test
'
;
spyOn
(
eventHub
,
'
$emit
'
);
vm
=
new
Component
({
vm
=
new
Component
({
propsData
:
{
propsData
:
{
formState
:
store
.
formState
,
formState
:
store
.
formState
,
...
@@ -27,4 +31,20 @@ describe('Title field component', () => {
...
@@ -27,4 +31,20 @@ describe('Title field component', () => {
vm
.
$el
.
querySelector
(
'
.form-control
'
).
value
,
vm
.
$el
.
querySelector
(
'
.form-control
'
).
value
,
).
toBe
(
'
test
'
);
).
toBe
(
'
test
'
);
});
});
it
(
'
triggers update with meta+enter
'
,
()
=>
{
vm
.
$el
.
querySelector
(
'
.form-control
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
true
));
expect
(
eventHub
.
$emit
,
).
toHaveBeenCalled
();
});
it
(
'
triggers update with ctrl+enter
'
,
()
=>
{
vm
.
$el
.
querySelector
(
'
.form-control
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
false
,
true
));
expect
(
eventHub
.
$emit
,
).
toHaveBeenCalled
();
});
});
});
spec/javascripts/issue_show/helpers.js
0 → 100644
View file @
6d4e8154
// eslint-disable-next-line import/prefer-default-export
export
const
keyboardDownEvent
=
(
code
,
metaKey
=
false
,
ctrlKey
=
false
)
=>
{
const
e
=
new
CustomEvent
(
'
keydown
'
);
e
.
keyCode
=
code
;
e
.
metaKey
=
metaKey
;
e
.
ctrlKey
=
ctrlKey
;
return
e
;
};
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