Use non-global jQuery reference within raven bundle

This commit is contained in:
Luke "Jared" Bennett 2017-05-25 07:12:36 +00:00 committed by Phil Hughes
parent ec2130bea8
commit 710e35378a
2 changed files with 2 additions and 19 deletions

View file

@ -1,4 +1,5 @@
import Raven from 'raven-js';
import $ from 'jquery';
const IGNORE_ERRORS = [
// Random plugins/extensions
@ -74,7 +75,7 @@ const RavenConfig = {
},
bindRavenErrors() {
window.$(document).on('ajaxError.raven', this.handleRavenErrors);
$(document).on('ajaxError.raven', this.handleRavenErrors);
},
handleRavenErrors(event, req, config, err) {

View file

@ -140,24 +140,6 @@ describe('RavenConfig', () => {
});
});
describe('bindRavenErrors', () => {
let $document;
let $;
beforeEach(() => {
$document = jasmine.createSpyObj('$document', ['on']);
$ = jasmine.createSpy('$').and.returnValue($document);
window.$ = $;
RavenConfig.bindRavenErrors();
});
it('should call .on', function () {
expect($document.on).toHaveBeenCalledWith('ajaxError.raven', RavenConfig.handleRavenErrors);
});
});
describe('handleRavenErrors', () => {
let event;
let req;