No need for the try/finally logic in the css tests, won't even work as expected.

This commit is contained in:
jeresig 2010-01-07 13:44:53 -05:00
parent 22ff8e9ea4
commit 0bb4fd0af7

View file

@ -120,69 +120,63 @@ if(jQuery.browser.msie) {
} }
test("css(String, Function)", function() { 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>" + jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" +
"<div class='cssFunction'></div>" + "<div class='cssFunction'></div>" +
"<div class='cssFunction'></div></div>") "<div class='cssFunction'></div></div>")
.appendTo("body"); .appendTo("body");
var index = 0; var index = 0;
jQuery("#cssFunctionTest div").css("font-size", function() { jQuery("#cssFunctionTest div").css("font-size", function() {
var size = sizes[index]; var size = sizes[index];
index++; index++;
return size; return size;
}); });
index = 0; index = 0;
jQuery("#cssFunctionTest div").each(function() { jQuery("#cssFunctionTest div").each(function() {
var computedSize = jQuery(this).css("font-size") var computedSize = jQuery(this).css("font-size")
var expectedSize = sizes[index] var expectedSize = sizes[index]
equals( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize ); equals( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize );
index++; index++;
}); });
} finally { jQuery("#cssFunctionTest").remove();
jQuery("#cssFunctionTest").remove();
}
}); });
test("css(Object) where values are Functions", function() { test("css(Object) where values are Functions", function() {
try { expect(3);
expect(3);
var sizes = ["10px", "20px", "30px"]; var sizes = ["10px", "20px", "30px"];
jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" + jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" +
"<div class='cssFunction'></div>" + "<div class='cssFunction'></div>" +
"<div class='cssFunction'></div></div>") "<div class='cssFunction'></div></div>")
.appendTo("body"); .appendTo("body");
var index = 0; var index = 0;
jQuery("#cssFunctionTest div").css({fontSize: function() { jQuery("#cssFunctionTest div").css({fontSize: function() {
var size = sizes[index]; var size = sizes[index];
index++; index++;
return size; return size;
}}); }});
index = 0; index = 0;
jQuery("#cssFunctionTest div").each(function() { jQuery("#cssFunctionTest div").each(function() {
var computedSize = jQuery(this).css("font-size") var computedSize = jQuery(this).css("font-size")
var expectedSize = sizes[index] var expectedSize = sizes[index]
equals( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize ); equals( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize );
index++; index++;
}); });
} finally { jQuery("#cssFunctionTest").remove();
jQuery("#cssFunctionTest").remove();
}
}); });
test("jQuery.css(elem, 'height') doesn't clear radio buttons (bug #1095)", function () { test("jQuery.css(elem, 'height') doesn't clear radio buttons (bug #1095)", function () {