+test("css(String, Function)", function() {
+ try {
+ expect(3);
+
+ var colors = ["#ff0000", "#00ff00", "#0000ff"];
+
+ 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("color", function() {
+ var color = colors[index];
+ index++;
+ return color;
+ });
+
+ index = 0;
+
+ jQuery("#cssFunctionTest div").each(function() {
+ equals( jQuery(this).css("color"), colors[index], "Div #" + index + " should be " + colors[index] );
+ index++;
+ });
+
+ } finally {
+ jQuery("#cssFunctionTest").remove();
+ }
+});
+
+test("css(Object) where values are Functions", function() {
+ try {
+ expect(3);
+
+ var colors = ["#ff0000", "#00ff00", "#0000ff"];
+
+ 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({color: function() {
+ var color = colors[index];
+ index++;
+ return color;
+ }});
+
+ index = 0;
+
+ jQuery("#cssFunctionTest div").each(function() {
+ equals( jQuery(this).css("color"), colors[index], "Div #" + index + " should be " + colors[index] );
+ index++;
+ });
+
+ } finally {
+ jQuery("#cssFunctionTest").remove();
+ }
+});
+