jspipe
Version:
JS/Pipe - coordinating asynchronous code without callbacks or chained functions
27 lines (17 loc) • 827 B
JavaScript
/*globals describe, jasmine, it, expect, JSPipe */
describe('JSPipe.EventPipe', function() {
var pseudoElement = jasmine.createSpyObj('pseudoElement', ['addEventListener', 'removeEventListener']),
handler = function() {},
p = new JSPipe.EventPipe(pseudoElement, 'someEventName', handler);
describe('constructor', function() {
it('adds an event listener to the element', function() {
expect(pseudoElement.addEventListener).toHaveBeenCalledWith('someEventName', handler);
});
});
describe('close', function() {
it('removes the event listener from the element', function() {
p.close();
expect(pseudoElement.removeEventListener).toHaveBeenCalledWith('someEventName', handler);
});
});
});