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/blob')
-rw-r--r--spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js22
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', () => {