File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 127
127
128
128
api . set = api ;
129
129
api . get = function ( key ) {
130
- return api ( key ) ;
130
+ return api . call ( api , key ) ;
131
131
} ;
132
132
api . getJSON = function ( ) {
133
133
return api . apply ( {
Original file line number Diff line number Diff line change @@ -125,6 +125,19 @@ QUnit.test('Call to read cookie when passing an Object Literal as the second arg
125
125
assert . strictEqual ( document . cookie , '' , 'should not create a cookie' ) ;
126
126
} ) ;
127
127
128
+ // github.com/js-cookie/js-cookie/issues/238
129
+ QUnit . test ( 'Call to read cookie when there is a window.json variable globally' , function ( assert ) {
130
+ assert . expect ( 1 ) ;
131
+ window . json = true ;
132
+ Cookies . set ( 'boolean' , true ) ;
133
+ assert . strictEqual ( typeof Cookies . get ( 'boolean' ) , 'string' , 'should not change the returned type' ) ;
134
+ // IE 6-8 throw an exception if trying to delete a window property
135
+ // See stackoverflow.com/questions/1073414/deleting-a-window-property-in-ie/1824228
136
+ try {
137
+ delete window . json ;
138
+ } catch ( e ) { }
139
+ } ) ;
140
+
128
141
QUnit . module ( 'write' , lifecycle ) ;
129
142
130
143
QUnit . test ( 'String primitive' , function ( assert ) {
You can’t perform that action at this time.
0 commit comments