@@ -1788,29 +1788,30 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
1788
1788
* @ngdoc method
1789
1789
* @name $httpBackend#flush
1790
1790
* @description
1791
- * Flushes pending requests using the trained responses in the order they arrived.
1792
- * If there are no pending requests when the flush method is called
1791
+ * Flushes pending requests in the order they arrived beginning at specified request using the trained responses .
1792
+ * If there are no pending requests to flush when the method is called
1793
1793
* an exception is thrown (as this typically a sign of programming error).
1794
1794
*
1795
1795
* @param {number= } count Number of responses to flush. If undefined,
1796
- * all pending requests will be flushed beginning at `start`.
1797
- * @param {number= } [start=0] Sequential request number at which to begin to flush.
1796
+ * all pending requests from `skip` will be flushed.
1797
+ * @param {number= } [skip=0] Number of pending requests to skip before flushing.
1798
+ * So it specifies the first request to flush.
1798
1799
*/
1799
- $httpBackend . flush = function ( count , start , digest ) {
1800
+ $httpBackend . flush = function ( count , skip , digest ) {
1800
1801
if ( digest !== false ) $rootScope . $digest ( ) ;
1801
- if ( ! responses . length ) throw new Error ( 'No pending request to flush !' ) ;
1802
1802
1803
- start = angular . isDefined ( start ) && start !== null ? start : 0 ;
1803
+ skip = skip || 0 ;
1804
+ if ( skip >= responses . length ) throw new Error ( 'No pending request to flush !' ) ;
1804
1805
1805
1806
if ( angular . isDefined ( count ) && count !== null ) {
1806
1807
while ( count -- ) {
1807
- var part = responses . splice ( start , 1 ) ;
1808
+ var part = responses . splice ( skip , 1 ) ;
1808
1809
if ( ! part . length ) throw new Error ( 'No more pending request to flush !' ) ;
1809
1810
part [ 0 ] ( ) ;
1810
1811
}
1811
1812
} else {
1812
- while ( responses . length > start ) {
1813
- responses . splice ( start , 1 ) [ 0 ] ( ) ;
1813
+ while ( responses . length > skip ) {
1814
+ responses . splice ( skip , 1 ) [ 0 ] ( ) ;
1814
1815
}
1815
1816
}
1816
1817
$httpBackend . verifyNoOutstandingExpectation ( digest ) ;
0 commit comments