Sha256: b440641db24a1b6d6bf849b8b03bfa8e2198113413eb60fb2c3471de164b36e0

Contents?: true

Size: 1.3 KB

Versions: 7

Compression:

Stored size: 1.3 KB

Contents

// ==========================================================================
// Project:   SproutCore Costello - Property Observing Library
// Copyright: ©2006-2011 Strobe Inc. and contributors.
//            Portions ©2008-2010 Apple Inc. All rights reserved.
// License:   Licensed 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

7 entries across 7 versions & 2 rubygems

Version Path
spade-0.0.1 sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.5.0.pre.5 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.5.0.pre.4.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.5.0.pre.4 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.5.0.pre.3 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.4.5 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js
sproutcore-1.4.5-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js