eventtargettester.js
No description.

File Location

/goog/events/eventtargettester.js

Classes

TestEvent
Custom event object for testing.

Public Protected Private

Enumerations

Global Functions

assertListenerIsCalled(listenernumCount)
Asserts that the given listener is called numCount number of times.
Arguments:
listener : !Function
The listener to check.
numCount : number
The number of times. See also the times() function below.
code »
assertNoOtherListenerIsCalled()
Asserts that no other listeners, other than those verified via assertListenerIsCalled, have been called since the last resetListeners().
code »
createListener(opt_listenerFn) !Function
Creates a listener that executes the given function (optional).
Arguments:
opt_listenerFn : !Function=
The optional function to execute.
Returns: !Function  The listener function.
code »
resetListeners()
Resets all listeners call count to 0.
code »
goog.events.eventTargetTester.setUp(listenableFactoryFnlistenFnunlistenFnunlistenByKeyFnlistenOnceFndispatchEventFnremoveAllFngetListenersFngetListenerFnhasListenerFnlistenKeyTypeunlistenFnReturnTypeobjectListenerSupported)
Setup step for the test functions. This needs to be called from the test setUp.
Arguments:
listenableFactoryFn : function():!goog.events.Listenable
Function that will return a new Listenable instance each time it is called.
listenFn : Function
Function that, given the same signature as goog.events.listen, will add listener to the given event target.
unlistenFn : Function
Function that, given the same signature as goog.events.unlisten, will remove listener from the given event target.
unlistenByKeyFn : Function
Function that, given 2 parameters: src and key, will remove the corresponding listener.
listenOnceFn : Function
Function that, given the same signature as goog.events.listenOnce, will add a one-time listener to the given event target.
dispatchEventFn : Function
Function that, given the same signature as goog.events.dispatchEvent, will dispatch the event on the given event target.
removeAllFn : Function
Function that, given the same signature as goog.events.removeAll, will remove all listeners according to the contract of goog.events.removeAll.
getListenersFn : Function
Function that, given the same signature as goog.events.getListeners, will retrieve listeners.
getListenerFn : Function
Function that, given the same signature as goog.events.getListener, will retrieve the listener object.
hasListenerFn : Function
Function that, given the same signature as goog.events.hasListener, will determine whether listeners exist.
listenKeyType : goog.events.eventTargetTester.KeyType
The key type returned by listen call.
unlistenFnReturnType : goog.events.eventTargetTester.UnlistenReturnType
Whether we should check return value from unlisten call. If unlisten does not return a value, this should be set to false.
objectListenerSupported : boolean
Whether listener of type Object is supported.
code »
goog.events.eventTargetTester.tearDown()
Teardown step for the test functions. This needs to be called from test teardown.
code »
testBubble()
No description.
code »
testCapture()
No description.
code »
testCaptureAndBubble()
No description.
code »
testDispatchEventDoesNotThrowWithDisposedEventTarget()
No description.
code »
testDispatchEventWithCustomEventObject()
No description.
code »
testDispatchEventWithObjectLiteral()
No description.
code »
testDisposingEventTargetRemovesListeners()
No description.
code »
testFiringEventBeforeDisposeInternalWorks()
No description.
code »
testGetListener()
No description.
code »
testGetListeners()
No description.
code »
testHandleEvent()
No description.
code »
testHasListener()
No description.
code »
testInstallingSameListeners()
No description.
code »
testListenAfterListenOnceRemoveOnceness()
No description.
code »
testListenOnce()
No description.
code »
testListenOnceAfterListenDoesNotChangeExistingListener()
No description.
code »
testListenOnceAfterListenOnceDoesNotChangeExistingListener()
No description.
code »
testLoopDetection()
No description.
code »
testNoListener()
No description.
code »
testOneListener()
No description.
code »
testPreventDefault()
No description.
code »
testPreventDefaultAtCapture()
No description.
code »
testPreventDefaultByReturningFalse()
No description.
code »
testRemoveAll()
No description.
code »
testRemoveAllCallsMarkAsRemoved()
No description.
code »
testRemoveAllWithType()
No description.
code »
testRemovingListener()
No description.
code »
testScope()
No description.
code »
testSetParentEventTarget()
No description.
code »
testStopPropagation()
No description.
code »
testStopPropagation2()
No description.
code »
testStopPropagation3()
No description.
code »
testStopPropagationAtCapture()
No description.
code »
testTwoListenersOfSameType()
No description.
code »
testUnlistenAfterListenOnce()
No description.
code »
testUnlistenByKeyInListen()
No description.
code »
testUnlistenInListen()
No description.
code »
testUnlistenWorksAfterDisposal()
Unlisten/unlistenByKey should still work after disposal. There are many circumstances when this is actually necessary. For example, a user may have listened to an event target and stored the key (e.g. in a goog.events.EventHandler) and only unlisten after the target has been disposed.
code »
times(n) number
The number of times a listener should have been executed. This exists to make assertListenerIsCalled more readable. This is used like so: assertListenerIsCalled(listener, times(2));
Arguments:
n : number
The number of times a listener should have been executed.
Returns: number  The number n.
code »

Global Variables

BOOLEAN :
Returns boolean indicating whether unlisten is successful.
Code »
UNDEFINED :
Returns undefind (no return value).
Code »
dispatchEvent :
No description.
Code »
eventTargets :
No description.
Code »
getListener :
No description.
Code »
getListeners :
No description.
Code »
hasListener :
No description.
Code »
keyType :
No description.
Code »
listen :
No description.
Code »
listenOnce :
No description.
Code »
listenableFactory :
No description.
Code »
listeners :
No description.
Code »
objectTypeListenerSupported :
No description.
Code »
removeAll :
No description.
Code »
unlisten :
No description.
Code »
unlistenByKey :
No description.
Code »
unlistenReturnType :
No description.
Code »

Directory events

File Reference