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
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/notes/components/discussion_jump_to_next_button_spec.js')
-rw-r--r--spec/frontend/notes/components/discussion_jump_to_next_button_spec.js23
1 files changed, 19 insertions, 4 deletions
diff --git a/spec/frontend/notes/components/discussion_jump_to_next_button_spec.js b/spec/frontend/notes/components/discussion_jump_to_next_button_spec.js
index 2ff9dbc5c19..183966cf435 100644
--- a/spec/frontend/notes/components/discussion_jump_to_next_button_spec.js
+++ b/spec/frontend/notes/components/discussion_jump_to_next_button_spec.js
@@ -1,14 +1,21 @@
import { shallowMount } from '@vue/test-utils';
import JumpToNextDiscussionButton from '~/notes/components/discussion_jump_to_next_button.vue';
+import { mockTracking } from '../../helpers/tracking_helper';
describe('JumpToNextDiscussionButton', () => {
- let wrapper;
const fromDiscussionId = 'abc123';
+ let wrapper;
+ let trackingSpy;
+ let jumpFn;
beforeEach(() => {
+ jumpFn = jest.fn();
wrapper = shallowMount(JumpToNextDiscussionButton, {
propsData: { fromDiscussionId },
});
+ wrapper.setMethods({ jumpToNextRelativeDiscussion: jumpFn });
+
+ trackingSpy = mockTracking('_category_', wrapper.element, jest.spyOn);
});
afterEach(() => {
@@ -20,9 +27,17 @@ describe('JumpToNextDiscussionButton', () => {
});
it('calls jumpToNextRelativeDiscussion when clicked', () => {
- const jumpToNextRelativeDiscussion = jest.fn();
- wrapper.setMethods({ jumpToNextRelativeDiscussion });
wrapper.find({ ref: 'button' }).trigger('click');
- expect(jumpToNextRelativeDiscussion).toHaveBeenCalledWith(fromDiscussionId);
+
+ expect(jumpFn).toHaveBeenCalledWith(fromDiscussionId);
+ });
+
+ it('sends the correct tracking event when clicked', () => {
+ wrapper.find({ ref: 'button' }).trigger('click');
+
+ expect(trackingSpy).toHaveBeenCalledWith('_category_', 'click_button', {
+ label: 'mr_next_unresolved_thread',
+ property: 'click_next_unresolved_thread',
+ });
});
});