Sha256: 226dc0b53c2c86d7ccb27049a83a2fbb12c182bdb2d9ec1f983fd9a7518adbe2

Contents?: true

Size: 1.73 KB

Versions: 41

Compression:

Stored size: 1.73 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 notest */

module("SC.IndexSet#min");

test("newly created index", function() {
  var set = SC.IndexSet.create();
  equals(set.get('min'), -1, 'min should be -1');
});

test("after adding one range", function() {
  var set = SC.IndexSet.create().add(4,2);
  equals(set.get('min'),4, 'min should be lowest index');
});

test("after adding range then removing part of range", function() {
  var set = SC.IndexSet.create().add(4,4).remove(2,4);
  equals(set.get('min'),6, 'min should be lowest index');
});

test("after adding range several disjoint ranges", function() {
  var set = SC.IndexSet.create().add(6000).add(4,4);
  equals(set.get('min'),4, 'min should be lowest index');
});

test("after removing disjoint range", function() {
  var set = SC.IndexSet.create().add(4,2).add(6000).remove(2,10);
  equals(set.get('min'),6000, 'min should be lowest index');
});

test("after removing all ranges", function() {
  var set = SC.IndexSet.create().add(4,2).add(6000).remove(3,6200);
  equals(set.get('min'), -1, 'min should be back to -1 with no content');
});


test("newly created index, clearing and then adding", function() {
  var set = SC.IndexSet.create().add(4,2);
  equals(set.get('min'), 4, 'min should be lowest index');
	set.clear()
  equals(set.get('min'), -1, 'min should be back to -1 with no content');
	set.add(7, 3)
  equals(set.get('min'), 7, 'min should be lowest index');
});

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
sproutcore-1.11.0 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.11.0.rc3 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.11.0.rc2 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.11.0.rc1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.10.3.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.10.2 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.10.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.10.0 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.10.0.rc.3 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.10.0.rc.2 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.10.0.rc.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.9.2 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.9.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.9.0 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.8.2.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.8.1 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.8.0 lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.7.1.beta-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.7.1.beta lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js
sproutcore-1.6.0.1-java lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js