From: jeresig Date: Thu, 7 Jan 2010 18:44:53 +0000 (-0500) Subject: No need for the try/finally logic in the css tests, won't even work as expected. X-Git-Url: http://git.asbjorn.biz/?a=commitdiff_plain;h=0bb4fd0af72846467a4c86a47f9cfa72874c21ae;p=jquery.git No need for the try/finally logic in the css tests, won't even work as expected. --- diff --git a/test/unit/css.js b/test/unit/css.js index 116312e..efcb913 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -120,69 +120,63 @@ if(jQuery.browser.msie) { } test("css(String, Function)", function() { - try { - expect(3); + expect(3); - var sizes = ["10px", "20px", "30px"]; + var sizes = ["10px", "20px", "30px"]; - jQuery("
" + - "
" + - "
") - .appendTo("body"); + jQuery("
" + + "
" + + "
") + .appendTo("body"); - var index = 0; + var index = 0; - jQuery("#cssFunctionTest div").css("font-size", function() { - var size = sizes[index]; - index++; - return size; - }); - - index = 0; - - jQuery("#cssFunctionTest div").each(function() { - var computedSize = jQuery(this).css("font-size") - var expectedSize = sizes[index] - equals( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize ); - index++; - }); + jQuery("#cssFunctionTest div").css("font-size", function() { + var size = sizes[index]; + index++; + return size; + }); - } finally { - jQuery("#cssFunctionTest").remove(); - } + index = 0; + + jQuery("#cssFunctionTest div").each(function() { + var computedSize = jQuery(this).css("font-size") + var expectedSize = sizes[index] + equals( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize ); + index++; + }); + + jQuery("#cssFunctionTest").remove(); }); test("css(Object) where values are Functions", function() { - try { - expect(3); + expect(3); - var sizes = ["10px", "20px", "30px"]; - - jQuery("
" + - "
" + - "
") - .appendTo("body"); + var sizes = ["10px", "20px", "30px"]; - var index = 0; + jQuery("
" + + "
" + + "
") + .appendTo("body"); + + var index = 0; - jQuery("#cssFunctionTest div").css({fontSize: function() { - var size = sizes[index]; - index++; - return size; - }}); + jQuery("#cssFunctionTest div").css({fontSize: function() { + var size = sizes[index]; + index++; + return size; + }}); - index = 0; + index = 0; - jQuery("#cssFunctionTest div").each(function() { - var computedSize = jQuery(this).css("font-size") - var expectedSize = sizes[index] - equals( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize ); - index++; - }); + jQuery("#cssFunctionTest div").each(function() { + var computedSize = jQuery(this).css("font-size") + var expectedSize = sizes[index] + equals( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize ); + index++; + }); - } finally { - jQuery("#cssFunctionTest").remove(); - } + jQuery("#cssFunctionTest").remove(); }); test("jQuery.css(elem, 'height') doesn't clear radio buttons (bug #1095)", function () {