Commit 9d5a99f1 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu Committed by Filipa Lacerda

Fix console error when loading issues

parent 34b88bc0
import Tracking from '~/tracking';
export const initSidebarTracking = () => {
new Tracking().bind('.js-issuable-sidebar');
new Tracking().bind(document.querySelector('.js-issuable-sidebar'));
};
export const trackEvent = (eventType, property, value = '') => {
......
---
title: Add Snowplow click tracking for issue sidebar
merge_request: 16833
author:
type: added
import Tracking from '~/tracking';
import { initSidebarTracking } from 'ee/event_tracking/issue_sidebar';
describe('ee/event_tracking/issue_sidebar', () => {
beforeEach(() => {
setFixtures(`
<div>
<div class="js-issuable-sidebar">I'm an issuable sidebar</div>
</div>
`);
});
const findIssuableSidebar = () => document.querySelector('.js-issuable-sidebar');
describe('initSidebarTracking', () => {
beforeEach(() => {
jest.spyOn(Tracking.prototype, 'bind');
initSidebarTracking();
});
it('bind to be called with element', () => {
expect(Tracking.prototype.bind).toHaveBeenCalledWith(findIssuableSidebar());
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment