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
5c8807f7
Commit
5c8807f7
authored
Aug 16, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
2e583211
2be32287
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
0 deletions
+35
-0
app/assets/javascripts/mr_notes/init_notes.js
app/assets/javascripts/mr_notes/init_notes.js
+4
-0
app/assets/javascripts/notes/components/discussion_keyboard_navigator.vue
...cripts/notes/components/discussion_keyboard_navigator.vue
+4
-0
spec/frontend/notes/components/discussion_keyboard_navigator_spec.js
...nd/notes/components/discussion_keyboard_navigator_spec.js
+27
-0
No files found.
app/assets/javascripts/mr_notes/init_notes.js
View file @
5c8807f7
...
...
@@ -59,6 +59,10 @@ export default () => {
render
(
createElement
)
{
const
isDiffView
=
this
.
activeTab
===
'
diffs
'
;
// NOTE: Even though `discussionKeyboardNavigator` is added to the `notes-app`,
// it adds a global key listener so it works on the diffs tab as well.
// If we create a single Vue app for all of the MR tabs, we should move this
// up the tree, to the root.
return
createElement
(
discussionKeyboardNavigator
,
{
props
:
{
isDiffView
}
},
[
createElement
(
'
notes-app
'
,
{
props
:
{
...
...
app/assets/javascripts/notes/components/discussion_keyboard_navigator.vue
View file @
5c8807f7
...
...
@@ -25,6 +25,10 @@ export default {
Mousetrap
.
bind
(
'
n
'
,
()
=>
this
.
jumpToNextDiscussion
());
Mousetrap
.
bind
(
'
p
'
,
()
=>
this
.
jumpToPreviousDiscussion
());
},
beforeDestroy
()
{
Mousetrap
.
unbind
(
'
n
'
);
Mousetrap
.
unbind
(
'
p
'
);
},
methods
:
{
...
mapActions
([
'
expandDiscussion
'
]),
jumpToNextDiscussion
()
{
...
...
spec/frontend/notes/components/discussion_keyboard_navigator_spec.js
View file @
5c8807f7
...
...
@@ -74,4 +74,31 @@ describe('notes/components/discussion_keyboard_navigator', () => {
expect
(
wrapper
.
vm
.
currentDiscussionId
).
toEqual
(
expectedPrevId
);
});
});
describe
(
'
on destroy
'
,
()
=>
{
beforeEach
(()
=>
{
jest
.
spyOn
(
Mousetrap
,
'
unbind
'
);
createComponent
();
wrapper
.
destroy
();
});
it
(
'
unbinds keys
'
,
()
=>
{
expect
(
Mousetrap
.
unbind
).
toHaveBeenCalledWith
(
'
n
'
);
expect
(
Mousetrap
.
unbind
).
toHaveBeenCalledWith
(
'
p
'
);
});
it
(
'
does not call jumpToNextDiscussion when pressing `n`
'
,
()
=>
{
Mousetrap
.
trigger
(
'
n
'
);
expect
(
wrapper
.
vm
.
jumpToDiscussion
).
not
.
toHaveBeenCalled
();
});
it
(
'
does not call jumpToNextDiscussion when pressing `p`
'
,
()
=>
{
Mousetrap
.
trigger
(
'
p
'
);
expect
(
wrapper
.
vm
.
jumpToDiscussion
).
not
.
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