diff options
| author | Igor Minar | 2011-02-04 13:00:46 -0800 | 
|---|---|---|
| committer | Igor Minar | 2011-02-04 14:11:52 -0800 | 
| commit | 568574b915086bcb1f08e3f8903ef79497c97435 (patch) | |
| tree | d1cbd0997f97a1bd9ce0592cd919542984afc868 /src | |
| parent | 46d690ff0188836688811dda9af1b99c44750c48 (diff) | |
| download | angular.js-568574b915086bcb1f08e3f8903ef79497c97435.tar.bz2 | |
mock's .xhr.flush() should throw exception when there is nothing to flush
Diffstat (limited to 'src')
| -rw-r--r-- | src/angular-mocks.js | 4 | 
1 files changed, 4 insertions, 0 deletions
| diff --git a/src/angular-mocks.js b/src/angular-mocks.js index 71a18d06..bbdcc94d 100644 --- a/src/angular-mocks.js +++ b/src/angular-mocks.js @@ -142,6 +142,10 @@ function MockBrowser() {    self.xhr.expectPUT    = angular.bind(self, self.xhr.expect, 'PUT');    self.xhr.expectJSON   = angular.bind(self, self.xhr.expect, 'JSON');    self.xhr.flush = function() { +    if (requests.length == 0) { +      throw new Error("No xhr requests to be flushed!"); +    } +      while(requests.length) {        requests.pop()();      } | 
