X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fcss.js;h=5e88254d78703220bb121d567fc64afa9d267ea6;hb=65ebf57c1e5d7fa96536b66d4fcacbafad8dc1e5;hp=270638e62f2ec00fc1790ca5076dd3a30718b680;hpb=64e4a879f9f92053ac4d58a3fffc0bbff6900b6e;p=jquery.git diff --git a/test/unit/css.js b/test/unit/css.js index 270638e..5e88254 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -1,7 +1,7 @@ module("css"); test("css(String|Hash)", function() { - expect(27); + expect(28); equals( jQuery('#main').css("display"), 'none', 'Check for css property "display"'); @@ -47,18 +47,30 @@ test("css(String|Hash)", function() { child.attr("class", "em"); equals( parseInt(child.css("fontSize")), 32, "Verify fontSize em set." ); + // Have to verify this as the result depends upon the browser's CSS + // support for font-size percentages child.attr("class", "prct"); - equals( parseInt(child.css("fontSize")), 24, "Verify fontSize % set." ); + var prctval = parseInt(child.css("fontSize")), checkval = 0; + if ( prctval === 16 || prctval === 24 ) { + checkval = prctval; + } + + equals( prctval, checkval, "Verify fontSize % set." ); + + equals( typeof child.css("width"), "string", "Make sure that a string width is returned from css('width')." ); }); test("css(String, Object)", function() { - expect(20); + expect(21); ok( jQuery('#nothiddendiv').is(':visible'), 'Modifying CSS display: Assert element is visible'); jQuery('#nothiddendiv').css("display", 'none'); ok( !jQuery('#nothiddendiv').is(':visible'), 'Modified CSS display: Assert element is hidden'); jQuery('#nothiddendiv').css("display", 'block'); ok( jQuery('#nothiddendiv').is(':visible'), 'Modified CSS display: Assert element is visible'); + jQuery("#nothiddendiv").css("top", "-1em"); + ok( jQuery("#nothiddendiv").css("top"), -16, "Check negative number in EMs." ); + jQuery('#floatTest').css('styleFloat', 'left'); equals( jQuery('#floatTest').css('styleFloat'), 'left', 'Modified CSS float using "styleFloat": Assert float is left'); jQuery('#floatTest').css('cssFloat', 'right');