1 // ========================================================================== 2 // Project: SproutCore Costello - Property Observing Library 3 // Copyright: ©2006-2011 Strobe Inc. and contributors. 4 // Portions ©2008-2011 Apple Inc. All rights reserved. 5 // License: Licensed under MIT license (see license.js) 6 // ========================================================================== 7 8 /*globals module test ok equals same CoreTest */ 9 10 sc_require('debug/test_suites/array/base'); 11 12 SC.ArraySuite.define(function(T) { 13 14 T.module("objectAt"); 15 16 test("should return object at specified index", function() { 17 var expected = T.expected(3), 18 obj = T.newObject(3), 19 len = 3, 20 idx; 21 22 for(idx=0;idx<len;idx++) { 23 equals(obj.objectAt(idx), expected[idx], 'obj.objectAt(%@) should match'.fmt(idx)); 24 } 25 26 }); 27 28 test("should return undefined when requesting objects beyond index", function() { 29 var obj = T.newObject(3); 30 equals(obj.objectAt(5), undefined, 'should return undefined for obj.objectAt(5) when len = 3'); 31 equals(T.object.objectAt(0), undefined, 'should return undefined for obj.objectAt(0) when len = 0'); 32 }); 33 34 }); 35