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
3dcb7a7e
Commit
3dcb7a7e
authored
Jan 07, 2019
by
Natalia Tepluhina
Committed by
Phil Hughes
Jan 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Ctrl+Enter immediately adds MR comment"
parent
026eefe5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
2 deletions
+51
-2
app/assets/javascripts/notes/components/note_form.vue
app/assets/javascripts/notes/components/note_form.vue
+9
-2
ee/changelogs/unreleased/8535-add-mr-comment-on-ctrl-enter.yml
...angelogs/unreleased/8535-add-mr-comment-on-ctrl-enter.yml
+5
-0
ee/spec/javascripts/notes/components/note_form_spec.js
ee/spec/javascripts/notes/components/note_form_spec.js
+37
-0
No files found.
app/assets/javascripts/notes/components/note_form.vue
View file @
3dcb7a7e
...
...
@@ -150,6 +150,13 @@ export default {
return
shouldResolve
||
shouldToggleState
;
},
handleKeySubmit
()
{
if
(
this
.
showBatchCommentsActions
)
{
this
.
handleAddToReview
();
}
else
{
this
.
handleUpdate
();
}
},
handleUpdate
(
shouldResolve
)
{
const
beforeSubmitDiscussionState
=
this
.
discussionResolved
;
this
.
isSubmitting
=
true
;
...
...
@@ -223,8 +230,8 @@ export default {
class=
"note-textarea js-gfm-input js-note-text js-autosize markdown-area js-vue-issue-note-form js-vue-textarea qa-reply-input"
aria-label=
"Description"
placeholder=
"Write a comment or drag your files here…"
@
keydown.meta.enter=
"handle
Update
();"
@
keydown.ctrl.enter=
"handle
Update
();"
@
keydown.meta.enter=
"handle
KeySubmit
();"
@
keydown.ctrl.enter=
"handle
KeySubmit
();"
@
keydown.up=
"editMyLastNote();"
@
keydown.esc=
"cancelHandler(true);"
></textarea>
...
...
ee/changelogs/unreleased/8535-add-mr-comment-on-ctrl-enter.yml
0 → 100644
View file @
3dcb7a7e
---
title
:
Resolve Ctrl+Enter immediately adds MR comment
merge_request
:
8932
author
:
type
:
fixed
ee/spec/javascripts/notes/components/note_form_spec.js
View file @
3dcb7a7e
import
Vue
from
'
vue
'
;
import
{
createStore
}
from
'
~/mr_notes/stores
'
;
import
issueNoteForm
from
'
~/notes/components/note_form.vue
'
;
import
{
keyboardDownEvent
}
from
'
spec/issue_show/helpers
'
;
import
{
noteableDataMock
,
discussionMock
,
notesDataMock
}
from
'
spec/notes/mock_data
'
;
describe
(
'
issue_note_form component
'
,
()
=>
{
...
...
@@ -35,6 +36,24 @@ describe('issue_note_form component', () => {
it
(
'
does not show resolve checkbox
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.qa-resolve-review-discussion
'
)).
toBe
(
null
);
});
describe
(
'
on enter
'
,
()
=>
{
it
(
'
should add comment when cmd+enter is pressed
'
,
()
=>
{
spyOn
(
vm
,
'
handleUpdate
'
).
and
.
callThrough
();
vm
.
$el
.
querySelector
(
'
textarea
'
).
value
=
'
Foo
'
;
vm
.
$el
.
querySelector
(
'
textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
true
));
expect
(
vm
.
handleUpdate
).
toHaveBeenCalled
();
});
it
(
'
should add comment when ctrl+enter is pressed
'
,
()
=>
{
spyOn
(
vm
,
'
handleUpdate
'
).
and
.
callThrough
();
vm
.
$el
.
querySelector
(
'
textarea
'
).
value
=
'
Foo
'
;
vm
.
$el
.
querySelector
(
'
textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
false
,
true
));
expect
(
vm
.
handleUpdate
).
toHaveBeenCalled
();
});
});
});
describe
(
'
with batch comments
'
,
()
=>
{
...
...
@@ -61,5 +80,23 @@ describe('issue_note_form component', () => {
done
();
});
});
describe
(
'
on enter
'
,
()
=>
{
it
(
'
should start review or add to review when cmd+enter is pressed
'
,
()
=>
{
spyOn
(
vm
,
'
handleAddToReview
'
).
and
.
callThrough
();
vm
.
$el
.
querySelector
(
'
textarea
'
).
value
=
'
Foo
'
;
vm
.
$el
.
querySelector
(
'
textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
true
));
expect
(
vm
.
handleAddToReview
).
toHaveBeenCalled
();
});
it
(
'
should start review or add to review when ctrl+enter is pressed
'
,
()
=>
{
spyOn
(
vm
,
'
handleAddToReview
'
).
and
.
callThrough
();
vm
.
$el
.
querySelector
(
'
textarea
'
).
value
=
'
Foo
'
;
vm
.
$el
.
querySelector
(
'
textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
false
,
true
));
expect
(
vm
.
handleAddToReview
).
toHaveBeenCalled
();
});
});
});
});
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