diff options
Diffstat (limited to 'spec/javascripts/sidebar/assignee_title_spec.js')
-rw-r--r-- | spec/javascripts/sidebar/assignee_title_spec.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/spec/javascripts/sidebar/assignee_title_spec.js b/spec/javascripts/sidebar/assignee_title_spec.js index 7fff7c075d9..6c65a55ff29 100644 --- a/spec/javascripts/sidebar/assignee_title_spec.js +++ b/spec/javascripts/sidebar/assignee_title_spec.js @@ -1,13 +1,12 @@ import Vue from 'vue'; import AssigneeTitle from '~/sidebar/components/assignees/assignee_title.vue'; +import { mockTracking, triggerEvent } from 'spec/helpers/tracking_helper'; describe('AssigneeTitle component', () => { let component; let AssigneeTitleComponent; - let statsSpy; beforeEach(() => { - statsSpy = spyOnDependency(AssigneeTitle, 'trackEvent'); AssigneeTitleComponent = Vue.extend(AssigneeTitle); }); @@ -105,15 +104,20 @@ describe('AssigneeTitle component', () => { expect(component.$el.querySelector('.edit-link')).not.toBeNull(); }); - it('calls trackEvent when edit is clicked', () => { + it('tracks the event when edit is clicked', () => { component = new AssigneeTitleComponent({ propsData: { numberOfAssignees: 0, editable: true, }, }).$mount(); - component.$el.querySelector('.js-sidebar-dropdown-toggle').click(); - expect(statsSpy).toHaveBeenCalled(); + const spy = mockTracking('_category_', component.$el, spyOn); + triggerEvent('.js-sidebar-dropdown-toggle'); + + expect(spy).toHaveBeenCalledWith('_category_', 'click_edit_button', { + label: 'right_sidebar', + property: 'assignee', + }); }); }); |