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
Léo-Paul Géneau
gitlab-ce
Commits
ee01ebd9
Commit
ee01ebd9
authored
May 08, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed UP arrow key not editing last comment in discussion
Closes #31348
parent
59c9ec5c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
1 deletion
+82
-1
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+1
-1
changelogs/unreleased/up-arrow-focus-discussion-comment.yml
changelogs/unreleased/up-arrow-focus-discussion-comment.yml
+4
-0
spec/javascripts/fixtures/merge_requests.rb
spec/javascripts/fixtures/merge_requests.rb
+16
-0
spec/javascripts/merge_request_notes_spec.js
spec/javascripts/merge_request_notes_spec.js
+61
-0
No files found.
app/assets/javascripts/notes.js
View file @
ee01ebd9
...
@@ -175,7 +175,7 @@ const normalizeNewlines = function(str) {
...
@@ -175,7 +175,7 @@ const normalizeNewlines = function(str) {
if
(
$textarea
.
val
()
!==
''
)
{
if
(
$textarea
.
val
()
!==
''
)
{
return
;
return
;
}
}
myLastNote
=
$
(
"
li.note[data-author-id='
"
+
gon
.
current_user_id
+
"
'][data-editable]:last
"
);
myLastNote
=
$
(
`li.note[data-author-id='
${
gon
.
current_user_id
}
'][data-editable]:last`
,
$textarea
.
closest
(
'
.note, #notes
'
)
);
if
(
myLastNote
.
length
)
{
if
(
myLastNote
.
length
)
{
myLastNoteEditBtn
=
myLastNote
.
find
(
'
.js-note-edit
'
);
myLastNoteEditBtn
=
myLastNote
.
find
(
'
.js-note-edit
'
);
return
myLastNoteEditBtn
.
trigger
(
'
click
'
,
[
true
,
myLastNote
]);
return
myLastNoteEditBtn
.
trigger
(
'
click
'
,
[
true
,
myLastNote
]);
...
...
changelogs/unreleased/up-arrow-focus-discussion-comment.yml
0 → 100644
View file @
ee01ebd9
---
title
:
Fix up arrow not editing last discussion comment
merge_request
:
author
:
spec/javascripts/fixtures/merge_requests.rb
View file @
ee01ebd9
...
@@ -16,6 +16,16 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont
...
@@ -16,6 +16,16 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont
sha:
merge_request
.
diff_head_sha
sha:
merge_request
.
diff_head_sha
)
)
end
end
let
(
:path
)
{
"files/ruby/popen.rb"
}
let
(
:position
)
do
Gitlab
::
Diff
::
Position
.
new
(
old_path:
path
,
new_path:
path
,
old_line:
nil
,
new_line:
14
,
diff_refs:
merge_request
.
diff_refs
)
end
render_views
render_views
...
@@ -39,6 +49,12 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont
...
@@ -39,6 +49,12 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont
render_merge_request
(
example
.
description
,
merged_merge_request
)
render_merge_request
(
example
.
description
,
merged_merge_request
)
end
end
it
'merge_requests/diff_comment.html.raw'
do
|
example
|
create
(
:diff_note_on_merge_request
,
project:
project
,
author:
admin
,
position:
position
,
noteable:
merge_request
)
create
(
:note_on_merge_request
,
author:
admin
,
project:
project
,
noteable:
merge_request
)
render_merge_request
(
example
.
description
,
merge_request
)
end
private
private
def
render_merge_request
(
fixture_file_name
,
merge_request
)
def
render_merge_request
(
fixture_file_name
,
merge_request
)
...
...
spec/javascripts/merge_request_notes_spec.js
0 → 100644
View file @
ee01ebd9
/* global Notes */
import
'
vendor/autosize
'
;
import
'
~/gl_form
'
;
import
'
~/lib/utils/text_utility
'
;
import
'
~/render_gfm
'
;
import
'
~/render_math
'
;
import
'
~/notes
'
;
fdescribe
(
'
Merge request notes
'
,
()
=>
{
window
.
gon
=
window
.
gon
||
{};
window
.
gl
=
window
.
gl
||
{};
gl
.
utils
=
gl
.
utils
||
{};
const
fixture
=
'
merge_requests/diff_comment.html.raw
'
;
preloadFixtures
(
fixture
);
beforeEach
(()
=>
{
loadFixtures
(
fixture
);
gl
.
utils
.
disableButtonIfEmptyField
=
_
.
noop
;
window
.
project_uploads_path
=
'
http://test.host/uploads
'
;
$
(
'
body
'
).
data
(
'
page
'
,
'
projects:merge_requests:show
'
);
window
.
gon
.
current_user_id
=
$
(
'
.note:last
'
).
data
(
'
author-id
'
);
return
new
Notes
(
''
,
[]);
});
describe
(
'
up arrow
'
,
()
=>
{
it
(
'
edits last comment when triggered in main form
'
,
()
=>
{
const
upArrowEvent
=
$
.
Event
(
'
keydown
'
);
upArrowEvent
.
which
=
38
;
spyOnEvent
(
'
.note:last .js-note-edit
'
,
'
click
'
);
$
(
'
.js-note-text
'
).
trigger
(
upArrowEvent
);
expect
(
'
click
'
).
toHaveBeenTriggeredOn
(
'
.note:last .js-note-edit
'
);
});
it
(
'
edits last comment in discussion when triggered in discussion form
'
,
(
done
)
=>
{
const
upArrowEvent
=
$
.
Event
(
'
keydown
'
);
upArrowEvent
.
which
=
38
;
spyOnEvent
(
'
.note-discussion .js-note-edit
'
,
'
click
'
);
$
(
'
.js-discussion-reply-button
'
).
click
();
setTimeout
(()
=>
{
expect
(
$
(
'
.note-discussion .js-note-text
'
),
).
toExist
();
$
(
'
.note-discussion .js-note-text
'
).
trigger
(
upArrowEvent
);
expect
(
'
click
'
).
toHaveBeenTriggeredOn
(
'
.note-discussion .js-note-edit
'
);
done
();
});
});
});
});
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