From 1219a9dce91f4edbc135dfc08299b4122b4825a8 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 1 Apr 2020 15:07:45 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../frontend/blob/pipeline_tour_success_modal_spec.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'spec/frontend/blob') diff --git a/spec/frontend/blob/pipeline_tour_success_modal_spec.js b/spec/frontend/blob/pipeline_tour_success_modal_spec.js index 613a7ce8303..99940225652 100644 --- a/spec/frontend/blob/pipeline_tour_success_modal_spec.js +++ b/spec/frontend/blob/pipeline_tour_success_modal_spec.js @@ -2,7 +2,7 @@ import pipelineTourSuccess from '~/blob/pipeline_tour_success_modal.vue'; import { shallowMount } from '@vue/test-utils'; import Cookies from 'js-cookie'; import { GlSprintf, GlModal } from '@gitlab/ui'; -import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; +import { mockTracking, triggerEvent, unmockTracking } from 'helpers/tracking_helper'; import modalProps from './pipeline_tour_success_mock_data'; describe('PipelineTourSuccessModal', () => { @@ -16,6 +16,9 @@ describe('PipelineTourSuccessModal', () => { trackingSpy = mockTracking('_category_', undefined, jest.spyOn); wrapper = shallowMount(pipelineTourSuccess, { propsData: modalProps, + stubs: { + GlModal, + }, }); cookieSpy = jest.spyOn(Cookies, 'remove'); @@ -41,11 +44,23 @@ describe('PipelineTourSuccessModal', () => { }); describe('tracking', () => { - it('send event for basic view of popover', () => { + it('send event for basic view of modal', () => { expect(trackingSpy).toHaveBeenCalledWith(undefined, undefined, { label: 'congratulate_first_pipeline', property: modalProps.humanAccess, }); }); + + it('send an event when go to pipelines is clicked', () => { + trackingSpy = mockTracking('_category_', wrapper.element, jest.spyOn); + const goToBtn = wrapper.find({ ref: 'goto' }); + triggerEvent(goToBtn.element); + + expect(trackingSpy).toHaveBeenCalledWith('_category_', 'click_button', { + label: 'congratulate_first_pipeline', + property: modalProps.humanAccess, + value: '10', + }); + }); }); }); -- cgit v1.2.3