}\r
\r
test("css(String|Hash)", function() {\r
- expect(8);\r
+ expect(19);\r
\r
ok( $('#main').css("display") == 'none', 'Check for css property "display"');\r
\r
ok( $('#floatTest').css('float') == 'right', 'Modified CSS float using "float": Assert float is right');\r
$('#floatTest').css({'font-size': '30px'});\r
ok( $('#floatTest').css('font-size') == '30px', 'Modified CSS font-size: Assert font-size is 30px');\r
+ \r
+ $.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {\r
+ $('#foo').css({opacity: n});\r
+ ok( $('#foo').css('opacity') == n, "Assert opacity is " + n + " as a String" );\r
+ $('#foo').css({opacity: parseFloat(n)});\r
+ ok( $('#foo').css('opacity') == n, "Assert opacity is " + n + " as a Number" );\r
+ }); \r
+ $('#foo').css({opacity: ''});\r
+ ok( $('#foo').css('opacity') == '1', "Assert opacity is 1 when set to an empty String" );\r
});\r
\r
test("css(String, Object)", function() {\r
- expect(7);\r
+ expect(18);\r
ok( $('#foo').is(':visible'), 'Modifying CSS display: Assert element is visible');\r
$('#foo').css('display', 'none');\r
ok( !$('#foo').is(':visible'), 'Modified CSS display: Assert element is hidden');\r
ok( $('#floatTest').css('float') == 'left', 'Modified CSS float using "float": Assert float is left');\r
$('#floatTest').css('font-size', '20px');\r
ok( $('#floatTest').css('font-size') == '20px', 'Modified CSS font-size: Assert font-size is 20px');\r
+ \r
+ $.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {\r
+ $('#foo').css('opacity', n);\r
+ ok( $('#foo').css('opacity') == n, "Assert opacity is " + n + " as a String" );\r
+ $('#foo').css('opacity', parseFloat(n));\r
+ ok( $('#foo').css('opacity') == n, "Assert opacity is " + n + " as a Number" );\r
+ });\r
+ $('#foo').css('opacity', '');\r
+ ok( $('#foo').css('opacity') == '1', "Assert opacity is 1 when set to an empty String" );\r
});\r
\r
test("text()", function() {\r