aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2010-02-13 02:18:38 -0500
committerjeresig <jeresig@gmail.com>2010-02-13 02:18:38 -0500
commit83a044f1b5a733dc7ea76dbc9b7dd3a3dc4b7f25 (patch)
tree388f0abf17080b0d112ce4a896cf5406deac6049 /test
parent94d925cd4615d88532737f3cd106ecd1f8c34bc3 (diff)
downloadjquery-83a044f1b5a733dc7ea76dbc9b7dd3a3dc4b7f25.tar.gz
jquery-83a044f1b5a733dc7ea76dbc9b7dd3a3dc4b7f25.zip
Make sure that no extra whitespace is leftover after an addClass. Fixes #6050.
Diffstat (limited to 'test')
-rw-r--r--test/unit/attributes.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index 70ae50dbd..234d58622 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -435,7 +435,7 @@ test("val(Function) with incoming value", function() {
});
var testAddClass = function(valueObj) {
- expect(2);
+ expect(4);
var div = jQuery("div");
div.addClass( valueObj("test") );
var pass = true;
@@ -448,6 +448,15 @@ var testAddClass = function(valueObj) {
var j = jQuery("#nonnodes").contents();
j.addClass( valueObj("asdf") );
ok( j.hasClass("asdf"), "Check node,textnode,comment for addClass" );
+
+ div = jQuery("<div/>");
+
+ div.addClass( valueObj("test") );
+ equals( div.attr("class"), "test", "Make sure there's no extra whitespace." );
+
+ div.attr("class", " foo");
+ div.addClass( valueObj("test") );
+ equals( div.attr("class"), "foo test", "Make sure there's no extra whitespace." );
};
test("addClass(String)", function() {