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("indexOf"); 15 16 test("should return index of object", 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.indexOf(expected[idx]), idx, 'obj.indexOf(%@) should match idx'.fmt(expected[idx])); 24 } 25 26 }); 27 28 test("should return -1 when requesting object not in index", function() { 29 var obj = T.newObject(3), foo = {}; 30 equals(obj.indexOf(foo), -1, 'obj.indexOf(foo) should be < 0'); 31 }); 32 33 }); 34