Sha256: 7f11a04c58515c19fde2c9de50ebd85b5867a4cf19b0952ab1515080bf1ea1ca

Contents?: true

Size: 1.06 KB

Versions: 11

Compression:

Stored size: 1.06 KB

Contents

// ==========================================================================
// Project:   SproutCore Costello - Property Observing Library
// Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
//            Portions ©2008-2010 Apple Inc. All rights reserved.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================

/*globals module test ok equals same CoreTest */

sc_require('debug/test_suites/array/base');

SC.ArraySuite.define(function(T) {
  
  T.module("indexOf");
  
  test("should return index of object", function() {
    var expected = T.expected(3), 
        obj      = T.newObject(3), 
        len      = 3,
        idx;
        
    for(idx=0;idx<len;idx++) {
      equals(obj.indexOf(expected[idx]), idx, 'obj.indexOf(%@) should match idx'.fmt(expected[idx]));
    }
    
  });
  
  test("should return -1 when requesting object not in index", function() {
    var obj = T.newObject(3), foo = {};
    equals(obj.indexOf(foo), -1, 'obj.indexOf(foo) should be < 0');
  });
  
});

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sproutcore-1.4.4-java lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/indexOf.js
sproutcore-1.4.4 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/indexOf.js
sproutcore-1.4.3.1 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/indexOf.js
sproutcore-1.4.3-java lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/indexOf.js
sproutcore-1.4.3 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/indexOf.js
sproutcore-1.4.2-java lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/indexOf.js
sproutcore-1.4.2 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/indexOf.js
sproutcore-1.4.1-java lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/indexOf.js
sproutcore-1.4.1 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/indexOf.js
sproutcore-1.4.0-java lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/indexOf.js
sproutcore-1.4.0 lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/indexOf.js