Improve this Doc View Source $timeout
- service in module ngMock
Overview
This service is just a simple decorator for $timeout service that adds a "flush" and "verifyNoPendingTasks" methods.
Methods
-
flush([delay]);
Flushes the queue of pending tasks.
This method is essentially an alias of
$flushPendingTasks.For historical reasons, this method will also flush non-$timeoutpending tasks, such as$qpromises and tasks scheduled via $applyAsync and $evalAsync.Deprecated: (since 1.7.3)This method flushes all types of tasks (not only timeouts), which is unintuitive. It is recommended to use
$flushPendingTasksinstead.Parameters
Param Type Details delay (optional)numbermaximum timeout amount to flush up until
-
verifyNoPendingTasks();
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-
$timeoutpending tasks, such as pending$httprequests, in-progress$routetransitions, unresolved$qpromises and tasks scheduled via $applyAsync and $evalAsync.It is recommended to use
$verifyNoPendingTasksinstead, which additionally supports verifying a specific type of tasks. For example, you can verify there are no pending timeouts with$verifyNoPendingTasks('$timeout').Deprecated: (since 1.7.3)This method takes all types of tasks (not only timeouts) into account, which is unintuitive. It is recommended to use
$verifyNoPendingTasksinstead, which additionally allows checking for timeouts only (with$verifyNoPendingTasks('$timeout')).
© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 3.0.
https://code.angularjs.org/1.8.2/docs/api/ngMock/service/$timeout