aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/attributes.js
diff options
context:
space:
mode:
authortimmywil <tim.willison@thisismedium.com>2011-06-19 18:58:47 -0400
committertimmywil <tim.willison@thisismedium.com>2011-06-19 18:58:47 -0400
commit96501d38a935187461d45c40f17f8327b2e7cd91 (patch)
tree81afb274f687b6b83773d865f0486b81c4b52ef0 /test/unit/attributes.js
parent124817e6684086ccf74e509309b73d4b4dd89932 (diff)
downloadjquery-96501d38a935187461d45c40f17f8327b2e7cd91.tar.gz
jquery-96501d38a935187461d45c40f17f8327b2e7cd91.zip
Allow similarly named classes (regression from 9499) and switch class retrieval to property when passing class to value functions. Fixes #9617.
Diffstat (limited to 'test/unit/attributes.js')
-rw-r--r--test/unit/attributes.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index 831f729c3..4716e5b53 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -762,7 +762,8 @@ test("val(select) after form.reset() (Bug #2551)", function() {
});
var testAddClass = function(valueObj) {
- expect(7);
+ expect(9);
+
var div = jQuery("div");
div.addClass( valueObj("test") );
var pass = true;
@@ -791,10 +792,16 @@ var testAddClass = function(valueObj) {
div.addClass( valueObj("bar baz") );
equals( div.attr("class"), "foo bar baz", "Make sure there isn't too much trimming." );
- div.removeAttr("class");
+ div.removeClass();
div.addClass( valueObj("foo") ).addClass( valueObj("foo") )
equal( div.attr("class"), "foo", "Do not add the same class twice in separate calls." );
- div.removeAttr("class");
+
+ div.addClass( valueObj("fo") );
+ equal( div.attr("class"), "foo fo", "Adding a similar class does not get interrupted." );
+ div.removeClass().addClass("wrap2");
+ ok( div.addClass("wrap").hasClass("wrap"), "Can add similarly named classes");
+
+ div.removeClass();
div.addClass( valueObj("bar bar") );
equal( div.attr("class"), "bar", "Do not add the same class twice in the same call." );
};
@@ -959,7 +966,7 @@ test("toggleClass(Function[, boolean])", function() {
test("toggleClass(Fucntion[, boolean]) with incoming value", function() {
expect(14);
- var e = jQuery("#firstp"), old = e.attr("class");
+ var e = jQuery("#firstp"), old = e.attr("class") || "";
ok( !e.is(".test"), "Assert class not present" );
e.toggleClass(function(i, val) {