Sha256: dc3d41ace54c1366c85a62bf68f45ac2087b512ed64f8fa36c9fb7068b22bfd2

Contents?: true

Size: 1.68 KB

Versions: 48

Compression:

Stored size: 1.68 KB

Contents

// ========================================================================
// CoreQuery Tests
// ========================================================================

module("CoreQuery.setClass()");

test("setClass(existing, NO) should remove the class", function() {
  var cq = SC.$('<div class="existing"></div>') ;
  equals(cq.hasClass('existing'), YES, "cq has existing");
  
  cq.setClass("existing", NO) ;
  equals(cq.hasClass('existing'), NO, 'cq should not have existing');
});

test("setClass(existing, YES) should do nothing", function() {
  var cq = SC.$('<div class="existing"></div>') ;
  equals(cq.hasClass('existing'), YES, "cq has existing");
  
  cq.setClass("existing", YES) ;
  equals(cq.hasClass('existing'), YES, 'cq should have existing');
});

test("setClass(new, YES) should add the class", function() {
  var cq = SC.$('<div class="existing"></div>') ;
  equals(cq.hasClass('new'), NO, "cq does not have new");
  
  cq.setClass("new", YES) ;
  equals(cq.hasClass('new'), YES, 'cq should have new');
});

test("setClass(new, NO) should do nothing", function() {
  var cq = SC.$('<div class="existing"></div>') ;
  equals(cq.hasClass('new'), NO, "cq does not have new");
  
  cq.setClass("new", NO) ;
  equals(cq.hasClass('new'), NO, "cq does not have new");
});

test("setClass(mixed, YES) should work across multiple", function() {
  var cq = SC.$('<div class="root">\
    <div class="mixed match"></div>\
    <div class="match"></div>\
  </div>').find('.match');
  equals(cq.length, 2, 'should have two items');
  equals(cq.hasClass("mixed"), NO, "should not all have mixed class");
  
  cq.setClass("mixed", YES);
  equals(cq.hasClass("mixed"), YES, "now all should have mixed class") ;
}) ;

Version data entries

48 entries across 48 versions & 2 rubygems

Version Path
sproutit-sproutcore-1.0.0.20090408130025 frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutit-sproutcore-1.0.0.20090416161445 frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutit-sproutcore-1.0.0.20090720093355 frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutit-sproutcore-1.0.0.20090720202429 frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutit-sproutcore-1.0.0.20090721125122 frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutit-sproutcore-1.0.126 frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutit-sproutcore-1.0.20090721145251 frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutit-sproutcore-1.0.20090721145280 frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutit-sproutcore-1.0.20090721145281 frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutit-sproutcore-1.0.20090721145282 frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutit-sproutcore-1.0.20090721145285 frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutit-sproutcore-1.0.203 frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutcore-1.4.5 lib/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutcore-1.4.5-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutcore-1.4.4-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutcore-1.4.4 lib/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutcore-1.4.3.1 lib/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutcore-1.4.3-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutcore-1.4.3 lib/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js
sproutcore-1.4.2-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js