Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit b62f33f

Browse files
committed
docs(ngMock/$httpBackend): improve description of .flush()
1 parent 72b6632 commit b62f33f

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/ngMock/angular-mocks.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,14 +1789,18 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
17891789
* @ngdoc method
17901790
* @name $httpBackend#flush
17911791
* @description
1792-
* Flushes pending requests in the order they arrived beginning at specified request using the trained responses.
1793-
* If there are no pending requests to flush when the method is called
1794-
* an exception is thrown (as this typically a sign of programming error).
1795-
*
1796-
* @param {number=} count Number of responses to flush. If undefined,
1797-
* all pending requests from `skip` will be flushed.
1798-
* @param {number=} [skip=0] Number of pending requests to skip before flushing.
1799-
* So it specifies the first request to flush.
1792+
* Flushes pending requests using the trained responses. Requests are flushed in the order they
1793+
* were made, but it is also possible to skip one or more requests (for example to have them
1794+
* flushed later). This is useful for simulating scenarios where responses arrive from the server
1795+
* in any order.
1796+
*
1797+
* If there are no pending requests to flush when the method is called, an exception is thrown (as
1798+
* this is typically a sign of programming error).
1799+
*
1800+
* @param {number=} count - Number of responses to flush. If undefined/null, all pending requests
1801+
* (starting after `skip`) will be flushed.
1802+
* @param {number=} [skip=0] - Number of pending requests to skip. For example, a value of `5`
1803+
* would skip the first 5 pending requests and start flushing from the 6th onwards.
18001804
*/
18011805
$httpBackend.flush = function(count, skip, digest) {
18021806
if (digest !== false) $rootScope.$digest();

0 commit comments

Comments
 (0)