diff options
Diffstat (limited to 'spec/javascripts/sidebar/lock/lock_issue_sidebar_spec.js')
-rw-r--r-- | spec/javascripts/sidebar/lock/lock_issue_sidebar_spec.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/spec/javascripts/sidebar/lock/lock_issue_sidebar_spec.js b/spec/javascripts/sidebar/lock/lock_issue_sidebar_spec.js index 2d930428230..decccbb8964 100644 --- a/spec/javascripts/sidebar/lock/lock_issue_sidebar_spec.js +++ b/spec/javascripts/sidebar/lock/lock_issue_sidebar_spec.js @@ -1,13 +1,12 @@ import Vue from 'vue'; import lockIssueSidebar from '~/sidebar/components/lock/lock_issue_sidebar.vue'; +import { mockTracking, triggerEvent } from 'spec/helpers/tracking_helper'; describe('LockIssueSidebar', () => { let vm1; let vm2; - let statsSpy; beforeEach(() => { - statsSpy = spyOnDependency(lockIssueSidebar, 'trackEvent'); const Component = Vue.extend(lockIssueSidebar); const mediator = { @@ -61,10 +60,14 @@ describe('LockIssueSidebar', () => { }); }); - it('calls trackEvent when "Edit" is clicked', () => { - vm1.$el.querySelector('.lock-edit').click(); + it('tracks an event when "Edit" is clicked', () => { + const spy = mockTracking('_category_', vm1.$el, spyOn); + triggerEvent('.lock-edit'); - expect(statsSpy).toHaveBeenCalled(); + expect(spy).toHaveBeenCalledWith('_category_', 'click_edit_button', { + label: 'right_sidebar', + property: 'lock_issue', + }); }); it('displays the edit form when opened from collapsed state', done => { |