]> source.dussan.org Git - jquery.git/commitdiff
No need for the try/finally logic in the css tests, won't even work as expected.
authorjeresig <jeresig@gmail.com>
Thu, 7 Jan 2010 18:44:53 +0000 (13:44 -0500)
committerjeresig <jeresig@gmail.com>
Thu, 7 Jan 2010 18:44:53 +0000 (13:44 -0500)
test/unit/css.js

index 116312e3fa7819db9778112a832447650916c083..efcb913d4b569acfe794a051e8d65cca47361d04 100644 (file)
@@ -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("<div id='cssFunctionTest'><div class='cssFunction'></div>" + 
-                                        "<div class='cssFunction'></div>" + 
-                                        "<div class='cssFunction'></div></div>")
-                       .appendTo("body");
+       jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" + 
+                                "<div class='cssFunction'></div>" + 
+                                "<div class='cssFunction'></div></div>")
+               .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("<div id='cssFunctionTest'><div class='cssFunction'></div>" + 
-                                        "<div class='cssFunction'></div>" + 
-                                        "<div class='cssFunction'></div></div>")
-                       .appendTo("body");
+       var sizes = ["10px", "20px", "30px"];
        
-               var index = 0;
+       jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" + 
+                                "<div class='cssFunction'></div>" + 
+                                "<div class='cssFunction'></div></div>")
+               .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 () {