Skip to content

Commit

Permalink
docs(ngMock/$httpBackend): improve description of .flush()
Browse files Browse the repository at this point in the history
  • Loading branch information
gkalpak committed Aug 8, 2016
1 parent 72b6632 commit b62f33f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/ngMock/angular-mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -1789,14 +1789,18 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
* @ngdoc method
* @name $httpBackend#flush
* @description
* Flushes pending requests in the order they arrived beginning at specified request using the trained responses.
* If there are no pending requests to flush when the method is called
* an exception is thrown (as this typically a sign of programming error).
*
* @param {number=} count Number of responses to flush. If undefined,
* all pending requests from `skip` will be flushed.
* @param {number=} [skip=0] Number of pending requests to skip before flushing.
* So it specifies the first request to flush.
* Flushes pending requests using the trained responses. Requests are flushed in the order they
* were made, but it is also possible to skip one or more requests (for example to have them
* flushed later). This is useful for simulating scenarios where responses arrive from the server
* in any order.
*
* If there are no pending requests to flush when the method is called, an exception is thrown (as
* this is typically a sign of programming error).
*
* @param {number=} count - Number of responses to flush. If undefined/null, all pending requests
* (starting after `skip`) will be flushed.
* @param {number=} [skip=0] - Number of pending requests to skip. For example, a value of `5`
* would skip the first 5 pending requests and start flushing from the 6th onwards.
*/
$httpBackend.flush = function(count, skip, digest) {
if (digest !== false) $rootScope.$digest();
Expand Down

0 comments on commit b62f33f

Please sign in to comment.