Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handler = function () {
/* eslint-disable no-invalid-this */
if (checkOrigin(this.origin, self.merchantUrl)) {
originalHandler.apply(this, arguments);
}
/* eslint-enable no-invalid-this */
};
}
namespacedEvent = this._namespaceEvent(eventName);
args = Array.prototype.slice.call(arguments);
args[0] = namespacedEvent;
args[1] = handler;
this._log('on', args);
bus.on.apply(bus, args);
this._listeners.push({
eventName: eventName,
handler: handler,
originalHandler: originalHandler
});
};
it('proxies to Framebus\'s on', function () {
this.bus.on(this.event, this.handler);
expect(framebus.on).to.be.calledWith('braintree:foo:' + this.event, this.handler);
});
it('doesn\'t proxy to framebus after calling', function () {
this.bus.teardown();
this.bus.on(this.event, this.handler);
expect(framebus.on).not.to.be.called;
this.bus.off(this.event, this.handler);
expect(framebus.off).not.to.be.called;
this.bus.emit(this.event);
expect(framebus.emit).not.to.be.called;
});
});