X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/2e847cf21b8ab9d15fa167b315ca5b2fa92638fc..6a7e4474cba9d8be4b2ec445e10f1691f7277c50:/test/unit/data/ArrayReader.js diff --git a/test/unit/data/ArrayReader.js b/test/unit/data/ArrayReader.js new file mode 100644 index 00000000..c2b2a786 --- /dev/null +++ b/test/unit/data/ArrayReader.js @@ -0,0 +1,40 @@ +/*! + * Ext JS Library 3.2.0 + * Copyright(c) 2006-2010 Ext JS, Inc. + * licensing@extjs.com + * http://www.extjs.com/license + */ +Ext.test.session.addTest( 'ArrayReader', { + name: 'readRecords', + setUp: function() { + this.reader = new Ext.data.ArrayReader({ + idIndex: 1, + fields: [ + {name: 'floater', type: 'float'}, + {name: 'id'}, + {name: 'totalProp', type: 'integer'}, + {name: 'bool', type: 'boolean'}, + {name: 'msg'} + ] + }); + this.data1 = [ + [ 1.23, 1, 6, true, 'hello' ] + ]; + this.rec1 = this.reader.readRecords(this.data1); + }, + test_tearDown: function() { + delete this.reader; + delete this.data1; + delete this.rec1; + }, + test_TotalRecords: function() { + Y.Assert.areSame(this.rec1.totalRecords, 1); + }, + test_Records: function() { + Y.Assert.areSame(this.rec1.records[0].data.floater, this.data1[0][0]); + Y.Assert.areSame(this.rec1.records[0].data.id, this.data1[0][1]); + Y.Assert.areSame(this.rec1.records[0].data.totalProp, this.data1[0][2]); + Y.Assert.areSame(this.rec1.records[0].data.bool, this.data1[0][3]); + Y.Assert.areSame(this.rec1.records[0].data.msg, this.data1[0][4]); + } +});