|
36 | 36 | var lifecycle = { |
37 | 37 | teardown: function () { |
38 | 38 | Cookies.defaults = {}; |
39 | | - delete Cookies.json; |
40 | 39 | Object.keys(Cookies.get()).forEach(Cookies.remove); |
41 | 40 | } |
42 | 41 | }; |
@@ -76,53 +75,6 @@ test('equality sign in cookie value', function () { |
76 | 75 | strictEqual(Cookies.get('c'), 'foo=bar', 'should include the entire value'); |
77 | 76 | }); |
78 | 77 |
|
79 | | -test('json = true', function () { |
80 | | - expect(1); |
81 | | - |
82 | | - if ('JSON' in window) { |
83 | | - Cookies.json = true; |
84 | | - Cookies.set('c', { foo: 'bar' }); |
85 | | - deepEqual(Cookies.get('c'), { foo: 'bar' }, 'should parse JSON'); |
86 | | - } else { |
87 | | - ok(true); |
88 | | - } |
89 | | -}); |
90 | | - |
91 | | -test('not existing with json = true', function () { |
92 | | - expect(1); |
93 | | - |
94 | | - if ('JSON' in window) { |
95 | | - Cookies.json = true; |
96 | | - strictEqual(Cookies.get('whatever'), undefined, "won't throw exception"); |
97 | | - } else { |
98 | | - ok(true); |
99 | | - } |
100 | | -}); |
101 | | - |
102 | | -test('string with json = true', function () { |
103 | | - expect(1); |
104 | | - |
105 | | - if ('JSON' in window) { |
106 | | - Cookies.json = true; |
107 | | - Cookies.set('c', 'v'); |
108 | | - strictEqual(Cookies.get('c'), 'v', 'should return value'); |
109 | | - } else { |
110 | | - ok(true); |
111 | | - } |
112 | | -}); |
113 | | - |
114 | | -test('invalid JSON string with json = true', function () { |
115 | | - expect(1); |
116 | | - |
117 | | - if ('JSON' in window) { |
118 | | - Cookies.set('c', 'v'); |
119 | | - Cookies.json = true; |
120 | | - strictEqual(Cookies.get('c'), undefined, "won't throw exception, returns undefined"); |
121 | | - } else { |
122 | | - ok(true); |
123 | | - } |
124 | | -}); |
125 | | - |
126 | 78 | test('percent character in cookie value', function () { |
127 | 79 | expect(1); |
128 | 80 | document.cookie = 'bad=foo%'; |
@@ -166,12 +118,6 @@ test('Call to read all when there are no cookies at all', function () { |
166 | 118 | deepEqual(Cookies.get(), {}, 'returns empty object'); |
167 | 119 | }); |
168 | 120 |
|
169 | | -test('Call to read all with json: true', function () { |
170 | | - Cookies.json = true; |
171 | | - Cookies.set('c', { foo: 'bar' }); |
172 | | - deepEqual(Cookies.get(), { c: { foo: 'bar' } }, 'returns JSON parsed cookies'); |
173 | | -}); |
174 | | - |
175 | 121 | //github.com/carhartl/jquery-cookie/pull/62 |
176 | 122 | test('provide a way for decoding PHP whitespace encoding', function () { |
177 | 123 | expect(1); |
@@ -270,18 +216,6 @@ test('defaults', function () { |
270 | 216 | ok(Cookies.set('c', 'v', { path: '/bar' }).match(/path=\/bar/), 'options argument has precedence'); |
271 | 217 | }); |
272 | 218 |
|
273 | | -test('json = true', function () { |
274 | | - expect(1); |
275 | | - Cookies.json = true; |
276 | | - |
277 | | - if ('JSON' in window) { |
278 | | - Cookies.set('c', { foo: 'bar' }); |
279 | | - strictEqual(document.cookie, 'c=' + JSON.stringify({ foo: 'bar' }).replace(/"/g, '%22'), 'should stringify JSON'); |
280 | | - } else { |
281 | | - ok(true); |
282 | | - } |
283 | | -}); |
284 | | - |
285 | 219 | test('Quote as the first character in the cookie value', function () { |
286 | 220 | expect(1); |
287 | 221 | Cookies.set('c', '"'); |
|
0 commit comments