X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fcss.js;h=5f8a74ae4faad718f6620193121d86966e188033;hb=ebaf374f2ac02e224ff0d0775b9709579404dd58;hp=efcb913d4b569acfe794a051e8d65cca47361d04;hpb=0bb4fd0af72846467a4c86a47f9cfa72874c21ae;p=jquery.git diff --git a/test/unit/css.js b/test/unit/css.js index efcb913..5f8a74a 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -149,6 +149,36 @@ test("css(String, Function)", function() { jQuery("#cssFunctionTest").remove(); }); +test("css(String, Function) with incoming value", function() { + expect(3); + + var sizes = ["10px", "20px", "30px"]; + + jQuery("
" + + "
" + + "
") + .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(); +}); + test("css(Object) where values are Functions", function() { expect(3); @@ -179,6 +209,36 @@ test("css(Object) where values are Functions", function() { jQuery("#cssFunctionTest").remove(); }); +test("css(Object) where values are Functions with incoming values", function() { + expect(3); + + var sizes = ["10px", "20px", "30px"]; + + jQuery("
" + + "
" + + "
") + .appendTo("body"); + + var index = 0; + + jQuery("#cssFunctionTest div").css({fontSize: 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(); +}); + test("jQuery.css(elem, 'height') doesn't clear radio buttons (bug #1095)", function () { expect(4);