Commit 2f4be6da authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'fix-console-errors-when-loading-issues' into 'master'

Fix console error when loading issues

See merge request gitlab-org/gitlab!16833
parents 34b88bc0 9d5a99f1
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