diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-06 12:09:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-06 12:09:17 +0300 |
commit | eaea945e0355826c58c3dcf887496ea91064f85c (patch) | |
tree | 0f20e03304d35e68375e99a606b9b94483e37ee5 /spec/frontend/blob | |
parent | cce8cf03d3bebe8b05375e4db0004328f84b28a2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/blob')
-rw-r--r-- | spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js b/spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js index 68f4c5c9e02..fb0964a3f32 100644 --- a/spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js +++ b/spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js @@ -1,7 +1,8 @@ import { shallowMount } from '@vue/test-utils'; import Popover from '~/blob/suggest_gitlab_ci_yml/components/popover.vue'; -import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; +import { mockTracking, unmockTracking, triggerEvent } from 'helpers/tracking_helper'; import * as utils from '~/lib/utils/common_utils'; +import { GlDeprecatedButton } from '@gitlab/ui'; jest.mock('~/lib/utils/common_utils', () => ({ ...jest.requireActual('~/lib/utils/common_utils'), @@ -27,6 +28,9 @@ describe('Suggest gitlab-ci.yml Popover', () => { dismissKey, humanAccess, }, + stubs: { + 'gl-popover': '<div><slot name="title"></slot><slot></slot></div>', + }, }); } @@ -88,6 +92,22 @@ describe('Suggest gitlab-ci.yml Popover', () => { property: expectedProperty, }); }); + + it('sends a tracking event when the popover is dismissed', () => { + const expectedLabel = commitTrackLabel; + const expectedAction = 'click_button'; + const expectedProperty = 'owner'; + const expectedValue = '10'; + const dismissButton = wrapper.find(GlDeprecatedButton); + + triggerEvent(dismissButton.element); + + expect(trackingSpy).toHaveBeenCalledWith('_category_', expectedAction, { + label: expectedLabel, + property: expectedProperty, + value: expectedValue, + }); + }); }); describe('when the popover is mounted with the trackLabel of the Confirm button popover at the bottom of the page', () => { |