JsUnit

## jsUnitMockTimeout.js

#### Summary

jsUnitMockTimeout.js changes the behavior of setTimeout, clearTimeout, setInterval and clearInterval to provide a powerful way of testing callbacks. Instead of setting up timed callbacks, the callbacks and the time to their execution are stored on a class called Clock. When the Clock is told to "advance time", the appropriate callbacks are executed. In this way, real time is taken out of the picture and the test author has control. Contributed by Nathan Wilmes of Pivotal Labs, http://www.pivotallabs.com

Class Summary
Clock | Clock stores callbacks and executes them when it is told to simulate the advancing of time

Method Summary
`static void` | `clearInterval(timeoutKey)` Mocks out clearInterval by clearing Clock's scheduledFunction for the given ID
`static void` | `clearTimeout(timeoutKey)` Mocks out clearTimeout by clearing Clock's scheduledFunction for the given ID
`static Object` | `setInterval(funcToCall, millis)` Mocks out setInterval by registering the callback with Clock
`static Object` | `setTimeout(funcToCall, millis)` Mocks out setTimeout by registering the callback with Clock

JsUnit

www.jsunit.net
Documentation generated by JSDoc on Sun Sep 9 15:34:58 2007