code: function makeEventTarget(target) {
      var listeners = {};
      target.on = function(event, func) {
        if (listeners[event]) {
          listeners[event].push(func);
        } else {
          listeners[event] = [func];
        }
      };
      target.fireEvent = function(event, data) {
        expect(target.on).toHaveBeenCalledWith(event, jasmine.any(Function));
        listeners[event].forEach(function(listener) {
          listener(data);
        });
      };
      target.removeListeners = function() {
        listeners = {};
      };
      spyOn(target, "on").and.callThrough();
    }
docs: Adds "on" listener that can register event listeners, which can later be fired through "fireEvent". It is expected that listeners will be regstered before events are fired.