diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/data/testsuite.css | 2 | ||||
-rw-r--r-- | test/unit/attributes.js | 13 |
2 files changed, 12 insertions, 3 deletions
diff --git a/test/data/testsuite.css b/test/data/testsuite.css index 47caf34a3..295740f5c 100644 --- a/test/data/testsuite.css +++ b/test/data/testsuite.css @@ -119,5 +119,5 @@ sup { display: none; } dfn { display: none; } /* #9239 Attach a background to the body( avoid crashes in removing the test element in support ) */ -body, div { background: url(http://www.ctemploymentlawblog.com/test.jpg) no-repeat -1000px 0; } +body, div { background: url(http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif) no-repeat -1000px 0; } diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 56c398e5c..37260f2fa 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -761,12 +761,14 @@ test("val(select) after form.reset() (Bug #2551)", function() { }); var testAddClass = function(valueObj) { - expect(5); + expect(7); var div = jQuery("div"); div.addClass( valueObj("test") ); var pass = true; for ( var i = 0; i < div.size(); i++ ) { - if ( div.get(i).className.indexOf("test") == -1 ) pass = false; + if ( !~div.get(i).className.indexOf("test") ) { + pass = false; + } } ok( pass, "Add Class" ); @@ -787,6 +789,13 @@ var testAddClass = function(valueObj) { div.attr("class", "foo"); div.addClass( valueObj("bar baz") ); equals( div.attr("class"), "foo bar baz", "Make sure there isn't too much trimming." ); + + div.removeAttr("class"); + 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("bar bar") ); + equal( div.attr("class"), "bar", "Do not add the same class twice in the same call." ); }; test("addClass(String)", function() { |