Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorKushal Pandya <kushalspandya@gmail.com>2019-08-16 09:14:34 +0300
committerKushal Pandya <kushalspandya@gmail.com>2019-08-16 09:14:34 +0300
commit2be32287f56c333734d6bc1c2fdd7498ea70d1e6 (patch)
treecb60aa88f03940ff4edec50ecdeebde5764f5279 /spec
parent41f22c6b0f8a6525b015357cf869c1d4ae91144a (diff)
parente55c7a9a3572ad37a8b69cd2d3db9ab24b5ba5ab (diff)
Merge branch 'fe-add-unbinds-to-discussion-keyboard-navigator' into 'master'
Add key unbinds to DiscussionKeyboardNavigator See merge request gitlab-org/gitlab-ce!31857
Diffstat (limited to 'spec')
-rw-r--r--spec/frontend/notes/components/discussion_keyboard_navigator_spec.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/frontend/notes/components/discussion_keyboard_navigator_spec.js b/spec/frontend/notes/components/discussion_keyboard_navigator_spec.js
index 6d50713999d..8881bedf3cc 100644
--- a/spec/frontend/notes/components/discussion_keyboard_navigator_spec.js
+++ b/spec/frontend/notes/components/discussion_keyboard_navigator_spec.js
@@ -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();
+ });
+ });
});