Commit 68e24140 by Usman Khalid

Use triggerHandler instead of trigger to bypass Karma's global error handler.

Karma has a global event handler for events named "error" which
expects the event data to be a string and so fails when this
event is triggered. So we use triggerHandler which only invokes
handlers attached via jQuery.
parent 6c26715a
(function (WAIT_TIMEOUT) { (function (WAIT_TIMEOUT) {
'use strict'; 'use strict';
xdescribe('VideoBumper', function () { describe('VideoBumper', function () {
var state, oldOTBD, waitForPlaying; var state, oldOTBD, waitForPlaying;
waitForPlaying = function (state, done) { waitForPlaying = function (state, done) {
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
}); });
it('can show the main video on error', function (done) { it('can show the main video on error', function (done) {
state.el.trigger('error'); state.el.triggerHandler('error');
jasmine.clock().tick(20); jasmine.clock().tick(20);
expect($('.is-bumper')).not.toExist(); expect($('.is-bumper')).not.toExist();
waitForPlaying(state, done); waitForPlaying(state, done);
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
it('can save appropriate states correctly on error', function () { it('can save appropriate states correctly on error', function () {
var saveState = jasmine.createSpy('saveState'); var saveState = jasmine.createSpy('saveState');
state.bumperState.videoSaveStatePlugin.saveState = saveState; state.bumperState.videoSaveStatePlugin.saveState = saveState;
state.el.trigger('error'); state.el.triggerHandler('error');
expect(state.storage.getItem('isBumperShown')).toBeTruthy(); expect(state.storage.getItem('isBumperShown')).toBeTruthy();
jasmine.clock().tick(20); jasmine.clock().tick(20);
expect(saveState).toHaveBeenCalledWith(true, { expect(saveState).toHaveBeenCalledWith(true, {
......
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