X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fcss.js;h=ff17149d275b66dfcf5eb485961b3e7001d056d5;hb=9ede46b00423491fe5852b16ab0ed448e1f0f055;hp=26dd7047d437be5af431043cc75a9e45027c0fc0;hpb=2ca36598954759c5b5dce569a39c52b981ed4ab2;p=jquery.git diff --git a/test/unit/css.js b/test/unit/css.js index 26dd704..ff17149 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -1,9 +1,9 @@ module("css"); test("css(String|Hash)", function() { - expect(29); + expect(34); - equals( jQuery('#main').css("display"), 'none', 'Check for css property "display"'); + equals( jQuery('#main').css("display"), 'block', 'Check for css property "display"'); ok( jQuery('#nothiddendiv').is(':visible'), 'Modifying CSS display: Assert element is visible'); jQuery('#nothiddendiv').css({display: 'none'}); @@ -19,6 +19,8 @@ test("css(String|Hash)", function() { equals( parseFloat(jQuery('#nothiddendiv').css('width')), width, 'Test negative width ignored') equals( parseFloat(jQuery('#nothiddendiv').css('height')), height, 'Test negative height ignored') + equals( jQuery('
').css('display'), 'none', 'Styles on disconnected nodes'); + jQuery('#floatTest').css({'float': 'right'}); equals( jQuery('#floatTest').css('float'), 'right', 'Modified CSS float using "float": Assert float is right'); jQuery('#floatTest').css({'font-size': '30px'}); @@ -61,6 +63,26 @@ test("css(String|Hash)", function() { equals( prctval, checkval, "Verify fontSize % set." ); equals( typeof child.css("width"), "string", "Make sure that a string width is returned from css('width')." ); + + var old = child[0].style.height; + + // Test NaN + child.css("height", parseFloat("zoo")); + equals( child[0].style.height, old, "Make sure height isn't changed on NaN." ); + + // Test null + child.css("height", null); + equals( child[0].style.height, old, "Make sure height isn't changed on null." ); + + old = child[0].style.fontSize; + + // Test NaN + child.css("font-size", parseFloat("zoo")); + equals( child[0].style.fontSize, old, "Make sure font-size isn't changed on NaN." ); + + // Test null + child.css("font-size", null); + equals( child[0].style.fontSize, old, "Make sure font-size isn't changed on null." ); }); test("css(String, Object)", function() { @@ -123,7 +145,7 @@ if(jQuery.browser.msie) { equals( jQuery('#foo').css('opacity'), '1', "Assert opacity is 1 when a different filter is set in IE, #1438" ); var filterVal = "progid:DXImageTransform.Microsoft.Alpha(opacity=30) progid:DXImageTransform.Microsoft.Blur(pixelradius=5)"; - var filterVal2 = "progid:DXImageTransform.Microsoft.alpha(opacity=100) progid:DXImageTransform.Microsoft.Blur(pixelradius=5)"; + var filterVal2 = "progid:DXImageTransform.Microsoft.Alpha(opacity=100) progid:DXImageTransform.Microsoft.Blur(pixelradius=5)"; var filterVal3 = "progid:DXImageTransform.Microsoft.Blur(pixelradius=5)"; jQuery('#foo').css("filter", filterVal); equals( jQuery('#foo').css("filter"), filterVal, "css('filter', val) works" ); @@ -266,3 +288,16 @@ test("jQuery.css(elem, 'height') doesn't clear radio buttons (bug #1095)", funct ok( !! jQuery(":checkbox:first", $checkedtest).attr("checked"), "Check first checkbox still checked." ); ok( ! jQuery(":checkbox:last", $checkedtest).attr("checked"), "Check last checkbox still NOT checked." ); }); + +test(":visible selector works properly on table elements (bug #4512)", function () { + expect(1); + + jQuery('#table').html('cellcell'); + equals(jQuery('#table td:visible').length, 1, "hidden cell is not perceived as visible"); +}); + +test(":visible selector works properly on children with a hidden parent (bug #4512)", function () { + expect(1); + jQuery('#table').css('display', 'none').html('cellcell'); + equals(jQuery('#table td:visible').length, 0, "hidden cell children not perceived as visible"); +});