diff options
| author | Misko Hevery | 2010-09-14 22:51:01 +0200 |
|---|---|---|
| committer | Misko Hevery | 2010-09-14 22:51:01 +0200 |
| commit | e3f760fbadedc977d9f5f461feafbaecab5a9046 (patch) | |
| tree | 2d39d26b3b371649cfc6f0ababf055e50518f283 /test/angular-mocks.js | |
| parent | 07699b1a70f2a979ecd600c826ba89e79279925c (diff) | |
| download | angular.js-e3f760fbadedc977d9f5f461feafbaecab5a9046.tar.bz2 | |
Adding cookie service
- Browser.cookies()
- MockBrowser
- $cookie service
- $sessionStore
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(){ |
