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

Commit 4897430

Browse files
committed
docs(ngMock/$httpBackend): improve description of .flush()
1 parent 098b6f5 commit 4897430

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/ngMock/angular-mocks.js

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

0 commit comments

Comments
 (0)