Sha256: 9dc519d4b112ef2a53359702908e698c4e5e3761f017eafc945cbe51d2bfbbd9
Contents?: true
Size: 1.33 KB
Versions: 9
Compression:
Stored size: 1.33 KB
Contents
// ========================================================================== // Project: SproutCore - JavaScript Application Framework // Copyright: ©2006-2009 Apple, Inc. and contributors. // License: Licened 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
9 entries across 9 versions & 1 rubygems