- try {
- 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 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++;
- });
-
- } finally {
- jQuery("#cssFunctionTest").remove();
- }
+ 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 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").remove();
+});
+
+test("css(String, Function) with incoming value", function() {
+ 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 index = 0;
+
+ jQuery("#cssFunctionTest div").css("font-size", function() {
+ var size = sizes[index];
+ index++;
+ return size;
+ });
+
+ index = 0;
+
+ jQuery("#cssFunctionTest div").css("font-size", function(i, computedSize) {
+ var expectedSize = sizes[index]
+ equals( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize );
+ index++;
+ return computedSize;
+ });
+
+ jQuery("#cssFunctionTest").remove();