Allows to create mock implementations of
EventBus, compatible to the "axEventBus" and
Creates a mock
EventBus, compatible to the "axEventBus" injection of a widget.
If no custom tick-scheduler function is passed through the options, the returned event bus has a method
flush, to synchronously deliver all pending as well as synchronously added events. It also has a method
drainAsync` to asynchronously run event handlers to completion, including additional asynchronously
||an alternative callback for scheduling the next event bus cycle (such as window.setTimeout)|
||an alternative error handler, e.g. to inspect error conditions during test. By default, exceptions thrown by subscribers to the mock will be reported using
||a fresh mock instance|
A mock version of
Offers spied-upon version of the usual axEventBus methods, including a spy on the unsubscribe-callback
subscribe. Also has as a
flush method for synchronous scheduling of events, and a
drainAsync to asynchronously run event handlers to completion.
Flushes all pending events and runs their subscriber callbacks. If new events are published synchronously from subscriber callbacks, these will also be processed.
This operation happens synchronously, so asynchronously triggered events (e.g. those published from a then handler) may not be processed.
Asynchronously flushes pending events and runs their subscriber callbacks. If new events are published synchronously from subscriber callbacks, these will also be processed. Additionally, if new events are published asynchronously but immediately (i.e. right after a call to Promise.resolve), they will be processed as well.
This operation happens asynchronously, so callers need to wait on the returned promise in order to observe the effects.
||a promise that is resolved when all events have been processed, and no more have been scheduled|