Closed andreymir closed 13 years ago
I'm using 0.9.5 version
Ooops, don't want to close the issue ... can not reopen :(( Sorry. Should I create new issue?
As a workaround use this function instead of asEventDispatcher() method: private function setupDspatcher(o: IEventDispatcher): void { var dispatcher: EventDispatcher = new EventDispatcher(o); stub(o).method('addEventListener').callsWithArguments( function(type: String, listener: Function, useCapture: Boolean = false, priority: int = 0, useWeakReference: Boolean = false): void { dispatcher.addEventListener(type, listener, useCapture, priority, useWeakReference); } ); stub(o).method('removeEventListener').callsWithArguments( function(type: String, listener: Function, useCapture: Boolean = false): void { dispatcher.removeEventListener(type, listener, useCapture); } ); stub(o).method('dispatchEvent').callsWithArguments(function(e: Event): Boolean { return dispatcher.dispatchEvent(e); }); }
I've opened the issue, will check it out. The asEventDispatcher()
should do much the same your setupDispatcher()
function.
Confirmed. Fixing now, I'll reply again once I've pushed the fix.
fixed.
Thanks! Works now.
Trying to mock ITransmitter interface, wich is derived from IEventDispatcher and dispatch event. The problem is that event dispatches twice. Here is the example:
At the end, 'events' array contains 2 objects, but should only one.