diff options
Diffstat (limited to 'test/servicesSpec.js')
| -rw-r--r-- | test/servicesSpec.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/servicesSpec.js b/test/servicesSpec.js index 258af46b..f40b8f5e 100644 --- a/test/servicesSpec.js +++ b/test/servicesSpec.js @@ -438,6 +438,7 @@ describe("service", function(){ it('should remove a cookie when a $cookies property is deleted', function() { scope.$cookies.oatmealCookie = 'nom nom'; scope.$eval(); + scope.$browser.poll(); expect(scope.$browser.cookies()). toEqual({'preexisting': 'oldCookie', 'oatmealCookie':'nom nom'}); @@ -446,6 +447,29 @@ describe("service", function(){ expect(scope.$browser.cookies()).toEqual({'preexisting': 'oldCookie'}); }); + + + it('should drop or reset cookies that browser refused to store', function() { + var i, longVal; + + for (i=0; i<5000; i++) { + longVal += '*'; + } + + //drop if no previous value + scope.$cookies.longCookie = longVal; + scope.$eval(); + expect(scope.$cookies).toEqual({'preexisting': 'oldCookie'}); + + + //reset if previous value existed + scope.$cookies.longCookie = 'shortVal'; + scope.$eval(); + expect(scope.$cookies).toEqual({'preexisting': 'oldCookie', 'longCookie': 'shortVal'}); + scope.$cookies.longCookie = longVal; + scope.$eval(); + expect(scope.$cookies).toEqual({'preexisting': 'oldCookie', 'longCookie': 'shortVal'}); + }); }); |
