Add .css(Function) incoming value tests.
This commit is contained in:
parent
0bb4fd0af7
commit
ebaf374f2a
1 changed files with 60 additions and 0 deletions
|
@ -149,6 +149,36 @@ test("css(String, Function)", function() {
|
||||||
jQuery("#cssFunctionTest").remove();
|
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();
|
||||||
|
});
|
||||||
|
|
||||||
test("css(Object) where values are Functions", function() {
|
test("css(Object) where values are Functions", function() {
|
||||||
expect(3);
|
expect(3);
|
||||||
|
|
||||||
|
@ -179,6 +209,36 @@ test("css(Object) where values are Functions", function() {
|
||||||
jQuery("#cssFunctionTest").remove();
|
jQuery("#cssFunctionTest").remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("css(Object) where values are Functions with incoming values", 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({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 () {
|
test("jQuery.css(elem, 'height') doesn't clear radio buttons (bug #1095)", function () {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue