X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fcore.js;h=6b2c3fe33f43eb1107f75bbd8ca7f46c3c2888ab;hb=24e036c7c88e7e3a1f878292e4b59914e1f4575c;hp=03f89d1cc098cd2d0b474e2052da4f06656933d4;hpb=14a3a5bf9d65d9910a730d53208e3dccb34e3704;p=jquery.git diff --git a/test/unit/core.js b/test/unit/core.js index 03f89d1..6b2c3fe 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -420,7 +420,7 @@ test("css(String|Hash)", function() { }); test("css(String, Object)", function() { - expect(20); + expect(21); ok( $('#foo').is(':visible'), 'Modifying CSS display: Assert element is visible'); $('#foo').css('display', 'none'); ok( !$('#foo').is(':visible'), 'Modified CSS display: Assert element is hidden'); @@ -454,6 +454,10 @@ test("css(String, Object)", function() { var j = $("#nonnodes").contents(); j.css("padding-left", "1px"); equals( j.css("padding-left"), "1px", "Check node,textnode,comment css works" ); + + // opera sometimes doesn't update 'display' correctly, see #2037 + $("#t2037")[0].innerHTML = $("#t2037")[0].innerHTML + equals( $("#t2037 .hidden").css("display"), "none", "Make sure browser thinks it is hidden" ); }); test("jQuery.css(elem, 'height') doesn't clear radio buttons (bug #1095)", function () { @@ -1054,12 +1058,17 @@ test("filter()", function() { }); test("not()", function() { - expect(5); + expect(8); ok( $("#main > p#ap > a").not("#google").length == 2, "not('selector')" ); + ok( $("#main > p#ap > a").not(document.getElementById("google")).length == 2, "not(DOMElement)" ); isSet( $("p").not(".result").get(), q("firstp", "ap", "sndp", "en", "sap", "first"), "not('.class')" ); isSet( $("p").not("#ap, #sndp, .result").get(), q("firstp", "en", "sap", "first"), "not('selector, selector')" ); isSet( $("p").not($("#ap, #sndp, .result")).get(), q("firstp", "en", "sap", "first"), "not(jQuery)" ); + ok( $("p").not(document.getElementsByTagName("p")).length == 0, "not(Array-like DOM collection)" ); isSet( $("#form option").not("option.emptyopt:contains('Nothing'),[selected],[value='1']").get(), q("option1c", "option1d", "option2c", "option3d" ), "not('complex selector')"); + + var selects = $("#form select"); + isSet( selects.not( selects[1] ), q("select1", "select3"), "filter out DOM element"); }); test("andSelf()", function() { @@ -1262,6 +1271,24 @@ test("$.className", function() { ok( c.has(x, "bar"), "Check has2" ); }); +test("$.data", function() { + expect(3); + var div = $("#foo")[0]; + ok( jQuery.data(div, "test") == undefined, "Check for no data exists" ); + jQuery.data(div, "test", "success"); + ok( jQuery.data(div, "test") == "success", "Check for added data" ); + jQuery.data(div, "test", "overwritten"); + ok( jQuery.data(div, "test") == "overwritten", "Check for overwritten data" ); +}); + +test("$.removeData", function() { + expect(1); + var div = $("#foo")[0]; + jQuery.data(div, "test", "testing"); + jQuery.removeData(div, "test"); + ok( jQuery.data(div, "test") == undefined, "Check removal of data" ); +}); + test("remove()", function() { expect(6); $("#ap").children().remove();