This service is just a simple decorator for $timeout service that adds a "flush" and "verifyNoPendingTasks" methods.
Flushes the queue of pending tasks.
This method is essentially an alias of $flushPendingTasks
.
$timeout
pending tasks, such as $q
promises and tasks scheduled via $applyAsync and $evalAsync. This method flushes all types of tasks (not only timeouts), which is unintuitive. It is recommended to use $flushPendingTasks
instead.
Param | Type | Details |
---|---|---|
delay (optional) | number | maximum timeout amount to flush up until |
Verifies that there are no pending tasks that need to be flushed. It throws an error if there are still pending tasks.
This method is essentially an alias of $verifyNoPendingTasks
(called with no arguments).
For historical reasons, this method will also verify non-$timeout
pending tasks, such as pending $http
requests, in-progress $route
transitions, unresolved $q
promises and tasks scheduled via $applyAsync and $evalAsync.
It is recommended to use $verifyNoPendingTasks
instead, which additionally supports verifying a specific type of tasks. For example, you can verify there are no pending timeouts with $verifyNoPendingTasks('$timeout')
.
This method takes all types of tasks (not only timeouts) into account, which is unintuitive. It is recommended to use $verifyNoPendingTasks
instead, which additionally allows checking for timeouts only (with $verifyNoPendingTasks('$timeout')
).
© 2010–2018 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://code.angularjs.org/1.7.8/docs/api/ngMock/service/$timeout