Sha256: 227729371259e3c2f3696f989ea073f806b284a7897f15e7e5455f3db23d89b3

Contents?: true

Size: 1.33 KB

Versions: 24

Compression:

Stored size: 1.33 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2011 Apple Inc. and contributors.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================

/*global module test equals context ok same */
var set, start, len ;
module("SC.IndexSet#rangeStartForIndex", {
  setup: function() {
    start = SC.IndexSet.HINT_SIZE*2 + 10 ;
    len  = Math.floor(SC.IndexSet.HINT_SIZE * 1.5);
    set = SC.IndexSet.create().add(start, len);
  }
});

test("index is start of range", function() {
  equals(set.rangeStartForIndex(start), start, 'should return start');
  equals(set.rangeStartForIndex(0), 0, 'should return first range');
});

test("index is middle of range", function() {
  equals(set.rangeStartForIndex(start+20), start, 'should return start');
  equals(set.rangeStartForIndex(start+SC.IndexSet.HINT_SIZE), start, 'should return start');
  equals(set.rangeStartForIndex(20), 0, 'should return first range');
});

test("index last index", function() {
  equals(set.rangeStartForIndex(start+len), start+len, 'should return end of range');
});

test("index past last index", function() {
  equals(set.rangeStartForIndex(start+len+20), start+len, 'should return end of range');
});


Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
sproutcore-1.7.1.beta-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.7.1.beta lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0.1-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0.1-x86-mingw32 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0.rc.2-x86-mingw32 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0.rc.2 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0.rc.2-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0.rc.1-x86-mingw32 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0.rc.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0.rc.1-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0.beta.3-x86-mingw32 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0.beta.3-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0.beta.3 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0.beta.2-x86-mingw32 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0.beta.2-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0.beta.2 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js
sproutcore-1.6.0.beta.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js