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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-31 21:07:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-31 21:07:42 +0300
commit580622bdb3c762a8e89facd8a3946881ee480442 (patch)
tree3ac9d759da23f78f95f50684bd238a9f76839538 /spec/frontend/blob
parentb211a4ea14d5e9ed9b0c248a4e8c5c1d85b542cb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/blob')
-rw-r--r--spec/frontend/blob/pipeline_tour_success_mock_data.js7
-rw-r--r--spec/frontend/blob/pipeline_tour_success_modal_spec.js (renamed from spec/frontend/blob/pipeline_tour_success_spec.js)25
2 files changed, 25 insertions, 7 deletions
diff --git a/spec/frontend/blob/pipeline_tour_success_mock_data.js b/spec/frontend/blob/pipeline_tour_success_mock_data.js
new file mode 100644
index 00000000000..7819fcce85d
--- /dev/null
+++ b/spec/frontend/blob/pipeline_tour_success_mock_data.js
@@ -0,0 +1,7 @@
+const modalProps = {
+ goToPipelinesPath: 'some_pipeline_path',
+ commitCookie: 'some_cookie',
+ humanAccess: 'maintainer',
+};
+
+export default modalProps;
diff --git a/spec/frontend/blob/pipeline_tour_success_spec.js b/spec/frontend/blob/pipeline_tour_success_modal_spec.js
index f6783b31a73..613a7ce8303 100644
--- a/spec/frontend/blob/pipeline_tour_success_spec.js
+++ b/spec/frontend/blob/pipeline_tour_success_modal_spec.js
@@ -2,19 +2,20 @@ 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 modalProps from './pipeline_tour_success_mock_data';
describe('PipelineTourSuccessModal', () => {
let wrapper;
let cookieSpy;
- const goToPipelinesPath = 'some_pipeline_path';
- const commitCookie = 'some_cookie';
+ let trackingSpy;
beforeEach(() => {
+ document.body.dataset.page = 'projects:blob:show';
+
+ trackingSpy = mockTracking('_category_', undefined, jest.spyOn);
wrapper = shallowMount(pipelineTourSuccess, {
- propsData: {
- goToPipelinesPath,
- commitCookie,
- },
+ propsData: modalProps,
});
cookieSpy = jest.spyOn(Cookies, 'remove');
@@ -22,6 +23,7 @@ describe('PipelineTourSuccessModal', () => {
afterEach(() => {
wrapper.destroy();
+ unmockTracking();
});
it('has expected structure', () => {
@@ -35,6 +37,15 @@ describe('PipelineTourSuccessModal', () => {
it('calls to remove cookie', () => {
wrapper.vm.disableModalFromRenderingAgain();
- expect(cookieSpy).toHaveBeenCalledWith(commitCookie);
+ expect(cookieSpy).toHaveBeenCalledWith(modalProps.commitCookie);
+ });
+
+ describe('tracking', () => {
+ it('send event for basic view of popover', () => {
+ expect(trackingSpy).toHaveBeenCalledWith(undefined, undefined, {
+ label: 'congratulate_first_pipeline',
+ property: modalProps.humanAccess,
+ });
+ });
});
});