diff options
| author | Misko Hevery | 2010-09-22 13:24:40 +0200 |
|---|---|---|
| committer | Misko Hevery | 2010-09-22 16:17:44 +0200 |
| commit | 0649009624e8e7bd6fb39537f62c6f00facbfb16 (patch) | |
| tree | e85077e148220ce75926bffce2d1e7daf8069945 /test/servicesSpec.js | |
| parent | eefb920d0e0345485a8eb120aeecc3b1aa9f6719 (diff) | |
| download | angular.js-0649009624e8e7bd6fb39537f62c6f00facbfb16.tar.bz2 | |
Refactored the Browser:
- change from using prototype to inner functions to help with better compression
- removed watchers (url/cookie) and introduced a poller concept
- moved the checking of URL and cookie into services which register with poolers
Benefits:
- Smaller minified file
- can call $browser.poll() from tests to simulate polling
- single place where setTimeout needs to be tested
- More testable $browser
Diffstat (limited to 'test/servicesSpec.js')
| -rw-r--r-- | test/servicesSpec.js | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/test/servicesSpec.js b/test/servicesSpec.js index b39e401c..6fa2c5f5 100644 --- a/test/servicesSpec.js +++ b/test/servicesSpec.js @@ -377,8 +377,7 @@ describe("service", function(){ expect(scope.$cookies).toEqual({}); scope.$browser.cookies('brandNew', 'cookie'); - //TODO: This is a hacky way of calling the watch function, once pooling is refactored, this will go away. - scope.$browser.watches[1](scope.$browser.cookies()); + scope.$browser.poll(); expect(scope.$cookies).toEqual({'brandNew':'cookie'}); }); @@ -448,8 +447,7 @@ describe("service", function(){ it('should deserialize json to object', function() { scope.$browser.cookies('objectCookie', '{"id":123,"name":"blah"}'); - //TODO: This is a hacky way of calling the watch function, once pooling is refactored, this will go away. - scope.$browser.watches[1](scope.$browser.cookies()); + scope.$browser.poll(); expect(scope.$sessionStore.get('objectCookie')).toEqual({id: 123, name: 'blah'}); }); |
