$browser
(service in module ngMock
)
This service is a mock implementation of angular.module.ng.$browser
. It provides fake
implementation for commonly used browser apis that are hard to test, e.g. setTimeout, xhr,
cookies, etc...
The api of this service is the same as that of the real $browser
, except
that there are several helper methods available which can be used in tests.
The following apis can be used in tests:
$defer
for executing functions via the setTimeout
api.Flushes all pending requests and executes the defer callbacks.
number(optional) – {number=} –
of milliseconds to flush. See defer.now
Current milliseconds mock time.