diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
commit | edaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch) | |
tree | 11f143effbfeba52329fb7afbd05e6e2a3790241 /spec/frontend/work_items/pages/work_item_root_spec.js | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'spec/frontend/work_items/pages/work_item_root_spec.js')
-rw-r--r-- | spec/frontend/work_items/pages/work_item_root_spec.js | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/spec/frontend/work_items/pages/work_item_root_spec.js b/spec/frontend/work_items/pages/work_item_root_spec.js index 02795751f33..ea26b2b4fb3 100644 --- a/spec/frontend/work_items/pages/work_item_root_spec.js +++ b/spec/frontend/work_items/pages/work_item_root_spec.js @@ -3,6 +3,7 @@ import { shallowMount } from '@vue/test-utils'; import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; +import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; import workItemQuery from '~/work_items/graphql/work_item.query.graphql'; import updateWorkItemMutation from '~/work_items/graphql/update_work_item.mutation.graphql'; import WorkItemsRoot from '~/work_items/pages/work_item_root.vue'; @@ -15,6 +16,7 @@ Vue.use(VueApollo); const WORK_ITEM_ID = '1'; describe('Work items root component', () => { + const mockUpdatedTitle = 'Updated title'; let wrapper; let fakeApollo; @@ -53,7 +55,6 @@ describe('Work items root component', () => { it('updates the title when it is edited', async () => { createComponent(); jest.spyOn(wrapper.vm.$apollo, 'mutate'); - const mockUpdatedTitle = 'Updated title'; await findTitle().vm.$emit('title-changed', mockUpdatedTitle); @@ -91,4 +92,32 @@ describe('Work items root component', () => { expect(findTitle().exists()).toBe(false); }); + + describe('tracking', () => { + let trackingSpy; + + beforeEach(() => { + trackingSpy = mockTracking('_category_', undefined, jest.spyOn); + + createComponent(); + }); + + afterEach(() => { + unmockTracking(); + }); + + it('tracks item title updates', async () => { + await findTitle().vm.$emit('title-changed', mockUpdatedTitle); + + await waitForPromises(); + + expect(trackingSpy).toHaveBeenCalledTimes(1); + expect(trackingSpy).toHaveBeenCalledWith('workItems:show', undefined, { + action: 'updated_title', + category: 'workItems:show', + label: 'item_title', + property: '[type_work_item]', + }); + }); + }); }); |