Sha256: c154deb09877581bb14e96afd942d3073f10740795c5ee03a1db496c2c4f69fa

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

Stored size: 1.26 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.indexAfter", {
  setup: function() {
    set = SC.IndexSet.create(5).add(10,5).add(100);
  }
});

test("no earlier index in set", function(){ 
  equals(set.indexAfter(3), 5, 'set.indexAfter(3) in %@ should start of first index range'.fmt(set));
});

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

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

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


test("single index range", function() {
  equals(set.indexAfter(5), 10, 'set.indexAfter(5) in %@ should start of next 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/indexAfter.js
sproutcore-1.5.0.pre.5 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexAfter.js
sproutcore-1.5.0.pre.4.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexAfter.js
sproutcore-1.5.0.pre.4 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexAfter.js
sproutcore-1.5.0.pre.3 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexAfter.js
sproutcore-1.4.5 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexAfter.js
sproutcore-1.4.5-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexAfter.js