diff options
| author | Vojta Jina | 2011-11-01 13:21:00 -0700 | 
|---|---|---|
| committer | Igor Minar | 2011-11-30 11:17:23 -0500 | 
| commit | e9f81b66316854bdd3a8548f028a64e86fc3e73c (patch) | |
| tree | efbcd07af8a8061bd850570818957a5ee78b59ca /src | |
| parent | afbe073121f13a23dc33a1d958c0a964029dc6ee (diff) | |
| download | angular.js-e9f81b66316854bdd3a8548f028a64e86fc3e73c.tar.bz2 | |
fix(mock.$httpBackend): flush() even requests sent during callbacks
Diffstat (limited to 'src')
| -rw-r--r-- | src/angular-mocks.js | 13 | 
1 files changed, 9 insertions, 4 deletions
| diff --git a/src/angular-mocks.js b/src/angular-mocks.js index 4cf4236c..17d317b7 100644 --- a/src/angular-mocks.js +++ b/src/angular-mocks.js @@ -657,10 +657,15 @@ angular.module.ngMock.$HttpBackendProvider = function() {      $httpBackend.flush = function(count) {        if (!responses.length) throw Error('No pending request to flush !'); -      count = count || responses.length; -      while (count--) { -        if (!responses.length) throw Error('No more pending request to flush !'); -        responses.shift()(); + +      if (angular.isDefined(count)) { +        while (count--) { +          if (!responses.length) throw Error('No more pending request to flush !'); +          responses.shift()(); +        } +      } else { +        while (responses.length) +          responses.shift()();        }      }; | 
