Sha256: 551772ac7de9ae61dd1c85893b85c9a6a82493aa2a80e7b5540516a91c934a48

Contents?: true

Size: 1.27 KB

Versions: 30

Compression:

Stored size: 1.27 KB

Contents

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

module("jQuery Buffer -- setClass");

// Buffered jQuery tries to call runloop, so we need a dummy runloop.
SC = {};
SC.RunLoop = {};
SC.RunLoop.currentRunLoop = {};
SC.RunLoop.currentRunLoop.invokeOnce = function(){};

test("Setting class on an element", function() {
  var sel = $.bufferedJQuery("<div></div>");
  sel.setClass('abc', true);
  jQuery.Buffer.flush();

  ok(sel[0].className.indexOf("abc") > -1, "Set the class name");

  sel.setClass('abc', false);
  jQuery.Buffer.flush();

  ok(sel[0].className.indexOf("abc") == -1, "Unset the class name");
});

test("Setting to undefined unsets", function() {
  var sel = $.bufferedJQuery("<div></div>");
  sel.setClass('abc', true);
  jQuery.Buffer.flush();

  ok(sel[0].className.indexOf("abc") > -1, "Set the class name");

  sel.setClass('abc');
  jQuery.Buffer.flush();

  ok(sel[0].className.indexOf("abc") == -1, "Unset the class name");
});

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
sproutcore-1.9.2 lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.9.1 lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.9.0 lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.8.2.1 lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.8.1 lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.8.0 lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.7.1.beta-java lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.7.1.beta lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.6.0.1-java lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.6.0.1 lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.6.0.1-x86-mingw32 lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.6.0 lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.6.0-java lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.6.0.rc.2-x86-mingw32 lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.6.0.rc.2 lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.6.0.rc.2-java lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.6.0.rc.1-x86-mingw32 lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.6.0.rc.1 lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.6.0.rc.1-java lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js
sproutcore-1.6.0.beta.3-x86-mingw32 lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js