You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
797 B

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*!
  2. * Ext JS Library 3.3.1
  3. * Copyright(c) 2006-2010 Sencha Inc.
  4. * licensing@sencha.com
  5. * http://www.sencha.com/license
  6. */
  7. Ext.test.session.addTest( 'Ext.util', {
  8. name: 'JSON',
  9. planned: 4,
  10. // same as Ext.encode
  11. // 1
  12. test_encode: function() {
  13. Y.Assert.areEqual( '{"foo":"bar"}', Ext.util.JSON.encode( { foo: 'bar' } ), 'Test encode with simple object' );
  14. },
  15. // same as Ext.decode
  16. // 2
  17. test_decode: function() {
  18. Y.ObjectAssert.hasKeys({
  19. foo: 'bar'
  20. }, Ext.util.JSON.decode( '{"foo":"bar"}' ), 'Test decode with a simple object');
  21. Y.ObjectAssert.hasKeys({
  22. foo: ['bar','baz']
  23. }, Ext.util.JSON.decode( '{"foo":["bar","baz"]}' ), 'Test decode with a hash + array');
  24. }
  25. // encodeDate
  26. });