Sha256: 5148bc969fc475e190af3646be37fc0d42a72128327f05bc89c0eebbfc676003

Contents?: true

Size: 1.31 KB

Versions: 17

Compression:

Stored size: 1.31 KB

Contents

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

var set ;

module("SC.IndexSet.indexBefore", {
  setup: function() {
    set = SC.IndexSet.create(5).add(10,5).add(100);
  }
});

test("no earlier index in set", function(){ 
  equals(set.indexBefore(4), -1, 'set.indexBefore(4) in %@ should not have index before it'.fmt(set));
});

test("with index after end of set", function() {
  equals(set.indexBefore(1000), 100, 'set.indexBefore(1000) in %@ should return last index in set'.fmt(set));
});

test("inside of multi-index range", function() {
  equals(set.indexBefore(12), 11, 'set.indexBefore(12) in %@ should return previous index'.fmt(set));
});

test("beginning of multi-index range", function() {
  equals(set.indexBefore(10), 5, 'set.indexBefore(10) in %@ should end of previous range'.fmt(set));
});


test("single index range", function() {
  equals(set.indexBefore(100), 14, 'set.indexBefore(100) in %@ should end of previous range multi-index range'.fmt(set));
});



Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
sproutit-sproutcore-1.0.20090721145285 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.0.1046 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.0.1043 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.0.1042 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.0.1037 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.0.1035 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.0.1031 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.0.1030 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.0.1029 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.0.1027 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.0.1028 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.0.1026 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.0.1025 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.0.1024 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.0.1009 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.0.1008 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.0.1003 frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js