Web UI for ARGUS server
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.

40 lines
1.3 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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( 'ArrayReader', {
  8. name: 'readRecords',
  9. setUp: function() {
  10. this.reader = new Ext.data.ArrayReader({
  11. idIndex: 1,
  12. fields: [
  13. {name: 'floater', type: 'float'},
  14. {name: 'id'},
  15. {name: 'totalProp', type: 'integer'},
  16. {name: 'bool', type: 'boolean'},
  17. {name: 'msg'}
  18. ]
  19. });
  20. this.data1 = [
  21. [ 1.23, 1, 6, true, 'hello' ]
  22. ];
  23. this.rec1 = this.reader.readRecords(this.data1);
  24. },
  25. test_tearDown: function() {
  26. delete this.reader;
  27. delete this.data1;
  28. delete this.rec1;
  29. },
  30. test_TotalRecords: function() {
  31. Y.Assert.areSame(this.rec1.totalRecords, 1);
  32. },
  33. test_Records: function() {
  34. Y.Assert.areSame(this.rec1.records[0].data.floater, this.data1[0][0]);
  35. Y.Assert.areSame(this.rec1.records[0].data.id, this.data1[0][1]);
  36. Y.Assert.areSame(this.rec1.records[0].data.totalProp, this.data1[0][2]);
  37. Y.Assert.areSame(this.rec1.records[0].data.bool, this.data1[0][3]);
  38. Y.Assert.areSame(this.rec1.records[0].data.msg, this.data1[0][4]);
  39. }
  40. });