Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should change the element that events are proxied from', function() {
var origin = document.createElement('div');
document.body.appendChild(origin);
var target = new EventEmitter();
var proxy = new DomEventEmitterProxy(origin, target);
var listener = sinon.stub();
target.on('click', listener);
var origin2 = document.createElement('div');
document.body.appendChild(origin2);
proxy.setOriginEmitter(origin2);
dom.triggerEvent(origin, 'click');
assert.strictEqual(0, listener.callCount);
dom.triggerEvent(origin2, 'click');
assert.strictEqual(1, listener.callCount);
assert.ok(listener.args[0][0]);
it('should not to clear screen cache the being used in a pending navigation', (done) => {
const event = new EventEmitter();
class StubScreen extends Screen {
constructor() {
super();
this.cacheable = true;
}
flip(surfaces) {
super.flip(surfaces);
event.emit('flip');
}
}
const callback = () => {
this.app.clearScreensCache();
assert.strictEqual(1, Object.keys(this.app.screens).length);
it('should not proxy event emitter events after disposed', function() {
var origin = new EventEmitter();
var target = new EventEmitter();
var proxy = new DomEventEmitterProxy(origin, target);
var listener = sinon.stub();
target.on('event1', listener);
proxy.dispose();
origin.emit('event1', 1, 2);
assert.strictEqual(0, listener.callCount);
});