diff options
Diffstat (limited to 'test/angular-mocks.js')
| -rw-r--r-- | test/angular-mocks.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/angular-mocks.js b/test/angular-mocks.js index bac2e800..1e547f77 100644 --- a/test/angular-mocks.js +++ b/test/angular-mocks.js @@ -26,6 +26,7 @@ function MockBrowser() { var self = this, expectations = {}, requests = []; + this.isMock = true; self.url = "http://server"; self.watches = []; @@ -72,6 +73,8 @@ function MockBrowser() { requests.pop()(); } }; + + self.cookieHash = {}; } MockBrowser.prototype = { @@ -90,11 +93,28 @@ MockBrowser.prototype = { this.watches.push(fn); }, + watchCookies: function(fn) { + this.watches.push(fn); + }, + fireUrlWatchers: function() { for(var i=0; i<this.watches.length; i++) { this.watches[i](this.url); } + }, + + cookies: function(name, value) { + if (name) { + if (value == undefined) { + delete this.cookieHash[name]; + } else { + this.cookieHash[name] = ""+value; + } + } else { + return copy(this.cookieHash); + } } + }; angular.service('$browser', function(){ |
