aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/css.js
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-07-13 21:50:58 +0000
committerYehuda Katz <wycats@gmail.com>2009-07-13 21:50:58 +0000
commit7cfec99858bf397714d3aac1c0ba4708d2ddb986 (patch)
tree68a9ff80632df3edaa59cae3cdd1baf830fcb454 /test/unit/css.js
parentc0802e5d21548ce5c41e51ff500308d5a5c9b249 (diff)
downloadjquery-7cfec99858bf397714d3aac1c0ba4708d2ddb986.tar.gz
jquery-7cfec99858bf397714d3aac1c0ba4708d2ddb986.zip
Uses the more stable font-size as a sentinel
Diffstat (limited to 'test/unit/css.js')
-rw-r--r--test/unit/css.js26
1 files changed, 14 insertions, 12 deletions
diff --git a/test/unit/css.js b/test/unit/css.js
index 20e55073d..649db5966 100644
--- a/test/unit/css.js
+++ b/test/unit/css.js
@@ -85,7 +85,7 @@ test("css(String, Function)", function() {
try {
expect(3);
- var colors = ["#ff0000", "#00ff00", "#0000ff"];
+ var sizes = ["10px", "20px", "30px"];
jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" +
"<div class='cssFunction'></div>" +
@@ -94,16 +94,18 @@ test("css(String, Function)", function() {
var index = 0;
- jQuery("#cssFunctionTest div").css("color", function() {
- var color = colors[index];
+ jQuery("#cssFunctionTest div").css("font-size", function() {
+ var size = sizes[index];
index++;
- return color;
+ return size;
});
index = 0;
jQuery("#cssFunctionTest div").each(function() {
- equals( jQuery(this).css("color"), colors[index], "Div #" + index + " should be " + colors[index] );
+ var computedSize = jQuery(this).css("font-size")
+ var expectedSize = sizes[index]
+ equals( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize );
index++;
});
@@ -116,7 +118,7 @@ test("css(Object) where values are Functions", function() {
try {
expect(3);
- var colors = ["rgb(255, 0, 0)", "rgb(0, 255, 0)", "rgb(0, 0, 255)"];
+ var sizes = ["10px", "20px", "30px"];
jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" +
"<div class='cssFunction'></div>" +
@@ -125,18 +127,18 @@ test("css(Object) where values are Functions", function() {
var index = 0;
- jQuery("#cssFunctionTest div").css({color: function() {
- var color = colors[index];
+ jQuery("#cssFunctionTest div").css({fontSize: function() {
+ var size = sizes[index];
index++;
- return color;
+ return size;
}});
index = 0;
jQuery("#cssFunctionTest div").each(function() {
- var computedColor = jQuery(this).css("color").replace(/ /g, '');
- var expectedColor = colors[index].replace(/ /g, '');
- equals( computedColor, expectedColor, "Div #" + index + " should be " + expectedColor );
+ var computedSize = jQuery(this).css("font-size")
+ var expectedSize = sizes[index]
+ equals( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize );
index++;
});