@@ -172,6 +172,26 @@ test('Call to read all with json: true', function () {
172172 deepEqual ( Cookies . get ( ) , { c : { foo : 'bar' } } , 'returns JSON parsed cookies' ) ;
173173} ) ;
174174
175+ //github.com/carhartl/jquery-cookie/pull/62
176+ test ( 'provide a way for decoding PHP whitespace encoding' , function ( ) {
177+ expect ( 1 ) ;
178+ document . cookie = 'c=foo+bar' ;
179+ var actual = Cookies . get ( 'c' , function ( value ) {
180+ return value . replace ( / \+ / g, ' ' ) ;
181+ } ) ;
182+ strictEqual ( actual , 'foo bar' , 'should convert pluses back to space' ) ;
183+ } ) ;
184+
185+ // github.com/carhartl/jquery-cookie/pull/166
186+ test ( 'provide a way for decoding chinese characters' , function ( ) {
187+ expect ( 1 ) ;
188+ document . cookie = 'c=%u5317%u4eac' ;
189+ var actual = Cookies . get ( 'c' , function ( value ) {
190+ return unescape ( value ) ;
191+ } ) ;
192+ strictEqual ( actual , '北京' , 'should convert chinese characters correctly' ) ;
193+ } ) ;
194+
175195module ( 'write' , lifecycle ) ;
176196
177197test ( 'String primitive' , function ( ) {
@@ -262,24 +282,11 @@ test('json = true', function () {
262282 }
263283} ) ;
264284
265- // github.com/carhartl/jquery-cookie/pull/62
266- test ( 'provide a way for decoding PHP whitespace encoding' , function ( ) {
285+ test ( 'Quote as the first character in the cookie value' , function ( ) {
267286 expect ( 1 ) ;
268- document . cookie = 'c=foo+bar' ;
269- var actual = Cookies . get ( 'c' , function ( value ) {
270- return value . replace ( / \+ / g, ' ' ) ;
271- } ) ;
272- strictEqual ( actual , 'foo bar' , 'should convert pluses back to space' ) ;
273- } ) ;
274-
275- // github.com/carhartl/jquery-cookie/pull/166
276- test ( 'provide a way for decoding chinese characters' , function ( ) {
277- expect ( 1 ) ;
278- document . cookie = 'c=%u5317%u4eac' ;
279- var actual = Cookies . get ( 'c' , function ( value ) {
280- return unescape ( value ) ;
281- } ) ;
282- strictEqual ( actual , '北京' , 'should convert chinese characters correctly' ) ;
287+ Cookies . set ( 'c' , '"' ) ;
288+ var actual = Cookies . get ( 'c' ) ;
289+ strictEqual ( actual , '"' , 'should read the quote value' ) ;
283290} ) ;
284291
285292module ( 'removeCookie' , lifecycle ) ;
0 commit comments