second batch

This commit is contained in:
louisremi 2011-04-11 22:33:29 +02:00
parent cccd092fe0
commit 11adde5127
6 changed files with 460 additions and 460 deletions

View file

@ -3,13 +3,13 @@ module("css", { teardown: moduleTeardown });
test("css(String|Hash)", function() {
expect(41);
equals( jQuery('#main').css("display"), 'block', 'Check for css property "display"');
equals( jQuery("#main").css("display"), "block", "Check for css property \"display\"");
ok( jQuery('#nothiddendiv').is(':visible'), 'Modifying CSS display: Assert element is visible');
jQuery('#nothiddendiv').css({display: 'none'});
ok( !jQuery('#nothiddendiv').is(':visible'), 'Modified CSS display: Assert element is hidden');
jQuery('#nothiddendiv').css({display: 'block'});
ok( jQuery('#nothiddendiv').is(':visible'), 'Modified CSS display: Assert element is visible');
ok( jQuery("#nothiddendiv").is(":visible"), "Modifying CSS display: Assert element is visible");
jQuery("#nothiddendiv").css({display: "none"});
ok( !jQuery("#nothiddendiv").is(":visible"), "Modified CSS display: Assert element is hidden");
jQuery("#nothiddendiv").css({display: "block"});
ok( jQuery("#nothiddendiv").is(":visible"), "Modified CSS display: Assert element is visible");
var div = jQuery( "<div>" );
@ -32,34 +32,34 @@ test("css(String|Hash)", function() {
div2.remove();
// handle negative numbers by ignoring #1599, #4216
jQuery('#nothiddendiv').css({ 'width': 1, 'height': 1 });
jQuery("#nothiddendiv").css( {width: 1, height: 1} );
var width = parseFloat(jQuery('#nothiddendiv').css('width')), height = parseFloat(jQuery('#nothiddendiv').css('height'));
jQuery('#nothiddendiv').css({ width: -1, height: -1 });
equals( parseFloat(jQuery('#nothiddendiv').css('width')), width, 'Test negative width ignored')
equals( parseFloat(jQuery('#nothiddendiv').css('height')), height, 'Test negative height ignored')
var width = parseFloat(jQuery("#nothiddendiv").css("width")), height = parseFloat(jQuery("#nothiddendiv").css("height"));
jQuery("#nothiddendiv").css({ width: -1, height: -1 });
equals( parseFloat(jQuery("#nothiddendiv").css("width")), width, "Test negative width ignored")
equals( parseFloat(jQuery("#nothiddendiv").css("height")), height, "Test negative height ignored")
equals( jQuery('<div style="display: none;">').css('display'), 'none', 'Styles on disconnected nodes');
equals( jQuery("<div style='display: none;'>").css("display"), "none", "Styles on disconnected nodes");
jQuery('#floatTest').css({'float': 'right'});
equals( jQuery('#floatTest').css('float'), 'right', 'Modified CSS float using "float": Assert float is right');
jQuery('#floatTest').css({'font-size': '30px'});
equals( jQuery('#floatTest').css('font-size'), '30px', 'Modified CSS font-size: Assert font-size is 30px');
jQuery("#floatTest").css({"float": "right"});
equals( jQuery("#floatTest").css("float"), "right", "Modified CSS float using \"float\": Assert float is right");
jQuery("#floatTest").css({"font-size": "30px"});
equals( jQuery("#floatTest").css("font-size"), "30px", "Modified CSS font-size: Assert font-size is 30px");
jQuery.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {
jQuery('#foo').css({opacity: n});
equals( jQuery('#foo').css('opacity'), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
jQuery('#foo').css({opacity: parseFloat(n)});
equals( jQuery('#foo').css('opacity'), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
jQuery.each("0,0.25,0.5,0.75,1".split(","), function(i, n) {
jQuery("#foo").css({opacity: n});
equals( jQuery("#foo").css("opacity"), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
jQuery("#foo").css({opacity: parseFloat(n)});
equals( jQuery("#foo").css("opacity"), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
});
jQuery('#foo').css({opacity: ''});
equals( jQuery('#foo').css('opacity'), '1', "Assert opacity is 1 when set to an empty String" );
jQuery("#foo").css({opacity: ""});
equals( jQuery("#foo").css("opacity"), "1", "Assert opacity is 1 when set to an empty String" );
equals( jQuery('#empty').css('opacity'), '0', "Assert opacity is accessible via filter property set in stylesheet in IE" );
jQuery('#empty').css({ opacity: '1' });
equals( jQuery('#empty').css('opacity'), '1', "Assert opacity is taken from style attribute when set vs stylesheet in IE with filters" );
equals( jQuery("#empty").css("opacity"), "0", "Assert opacity is accessible via filter property set in stylesheet in IE" );
jQuery("#empty").css({ opacity: "1" });
equals( jQuery("#empty").css("opacity"), "1", "Assert opacity is taken from style attribute when set vs stylesheet in IE with filters" );
var div = jQuery('#nothiddendiv'), child = jQuery('#nothiddendivchild');
var div = jQuery("#nothiddendiv"), child = jQuery("#nothiddendivchild");
equals( parseInt(div.css("fontSize")), 16, "Verify fontSize px set." );
equals( parseInt(div.css("font-size")), 16, "Verify fontSize px set." );
@ -107,7 +107,7 @@ test("css(String|Hash)", function() {
test("css() explicit and relative values", function() {
expect(9);
var $elem = jQuery('#nothiddendiv');
var $elem = jQuery("#nothiddendiv");
$elem.css({ width: 1, height: 1 });
equals( $elem.width(), 1, "Initial css set or width/height works (hash)" );
@ -140,28 +140,28 @@ test("css() explicit and relative values", function() {
test("css(String, Object)", function() {
expect(22);
ok( jQuery('#nothiddendiv').is(':visible'), 'Modifying CSS display: Assert element is visible');
jQuery('#nothiddendiv').css("display", 'none');
ok( !jQuery('#nothiddendiv').is(':visible'), 'Modified CSS display: Assert element is hidden');
jQuery('#nothiddendiv').css("display", 'block');
ok( jQuery('#nothiddendiv').is(':visible'), 'Modified CSS display: Assert element is visible');
ok( jQuery("#nothiddendiv").is(":visible"), "Modifying CSS display: Assert element is visible");
jQuery("#nothiddendiv").css("display", "none");
ok( !jQuery("#nothiddendiv").is(":visible"), "Modified CSS display: Assert element is hidden");
jQuery("#nothiddendiv").css("display", "block");
ok( jQuery("#nothiddendiv").is(":visible"), "Modified CSS display: Assert element is visible");
jQuery("#nothiddendiv").css("top", "-1em");
ok( jQuery("#nothiddendiv").css("top"), -16, "Check negative number in EMs." );
jQuery('#floatTest').css('float', 'left');
equals( jQuery('#floatTest').css('float'), 'left', 'Modified CSS float using "float": Assert float is left');
jQuery('#floatTest').css('font-size', '20px');
equals( jQuery('#floatTest').css('font-size'), '20px', 'Modified CSS font-size: Assert font-size is 20px');
jQuery("#floatTest").css("float", "left");
equals( jQuery("#floatTest").css("float"), "left", "Modified CSS float using \"float\": Assert float is left");
jQuery("#floatTest").css("font-size", "20px");
equals( jQuery("#floatTest").css("font-size"), "20px", "Modified CSS font-size: Assert font-size is 20px");
jQuery.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {
jQuery('#foo').css('opacity', n);
equals( jQuery('#foo').css('opacity'), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
jQuery('#foo').css('opacity', parseFloat(n));
equals( jQuery('#foo').css('opacity'), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
jQuery.each("0,0.25,0.5,0.75,1".split(","), function(i, n) {
jQuery("#foo").css("opacity", n);
equals( jQuery("#foo").css("opacity"), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
jQuery("#foo").css("opacity", parseFloat(n));
equals( jQuery("#foo").css("opacity"), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
});
jQuery('#foo').css('opacity', '');
equals( jQuery('#foo').css('opacity'), '1', "Assert opacity is 1 when set to an empty String" );
jQuery("#foo").css("opacity", "");
equals( jQuery("#foo").css("opacity"), "1", "Assert opacity is 1 when set to an empty String" );
// using contents will get comments regular, text, and comment nodes
var j = jQuery("#nonnodes").contents();
@ -181,7 +181,7 @@ test("css(String, Object)", function() {
// Test for Bug #5509
var success = true;
try {
jQuery('#foo').css("backgroundColor", "rgba(0, 0, 0, 0.1)");
jQuery("#foo").css("backgroundColor", "rgba(0, 0, 0, 0.1)");
}
catch (e) {
success = false;
@ -192,19 +192,19 @@ test("css(String, Object)", function() {
if ( !jQuery.support.opacity ) {
test("css(String, Object) for MSIE", function() {
// for #1438, IE throws JS error when filter exists but doesn't have opacity in it
jQuery('#foo').css("filter", "progid:DXImageTransform.Microsoft.Chroma(color='red');");
equals( jQuery('#foo').css('opacity'), '1', "Assert opacity is 1 when a different filter is set in IE, #1438" );
jQuery("#foo").css("filter", "progid:DXImageTransform.Microsoft.Chroma(color='red');");
equals( jQuery("#foo").css("opacity"), "1", "Assert opacity is 1 when a different filter is set in IE, #1438" );
var filterVal = "progid:DXImageTransform.Microsoft.Alpha(opacity=30) progid:DXImageTransform.Microsoft.Blur(pixelradius=5)";
var filterVal2 = "progid:DXImageTransform.Microsoft.alpha(opacity=100) progid:DXImageTransform.Microsoft.Blur(pixelradius=5)";
var filterVal3 = "progid:DXImageTransform.Microsoft.Blur(pixelradius=5)";
jQuery('#foo').css("filter", filterVal);
equals( jQuery('#foo').css("filter"), filterVal, "css('filter', val) works" );
jQuery('#foo').css("opacity", 1);
equals( jQuery('#foo').css("filter"), filterVal2, "Setting opacity in IE doesn't duplicate opacity filter" );
equals( jQuery('#foo').css("opacity"), 1, "Setting opacity in IE with other filters works" );
jQuery('#foo').css("filter", filterVal3).css("opacity", 1);
ok( jQuery('#foo').css("filter").indexOf(filterVal3) !== -1, "Setting opacity in IE doesn't clobber other filters" );
jQuery("#foo").css("filter", filterVal);
equals( jQuery("#foo").css("filter"), filterVal, "css('filter', val) works" );
jQuery("#foo").css("opacity", 1);
equals( jQuery("#foo").css("filter"), filterVal2, "Setting opacity in IE doesn't duplicate opacity filter" );
equals( jQuery("#foo").css("opacity"), 1, "Setting opacity in IE with other filters works" );
jQuery("#foo").css("filter", filterVal3).css("opacity", 1);
ok( jQuery("#foo").css("filter").indexOf(filterVal3) !== -1, "Setting opacity in IE doesn't clobber other filters" );
});
}
@ -343,14 +343,14 @@ test("jQuery.css(elem, 'height') doesn't clear radio buttons (bug #1095)", funct
test(":visible selector works properly on table elements (bug #4512)", function () {
expect(1);
jQuery('#table').html('<tr><td style="display:none">cell</td><td>cell</td></tr>');
equals(jQuery('#table td:visible').length, 1, "hidden cell is not perceived as visible");
jQuery("#table").html("<tr><td style='display:none'>cell</td><td>cell</td></tr>");
equals(jQuery("#table td:visible").length, 1, "hidden cell is not perceived as visible");
});
test(":visible selector works properly on children with a hidden parent (bug #4512)", function () {
expect(1);
jQuery('#table').css('display', 'none').html('<tr><td>cell</td><td>cell</td></tr>');
equals(jQuery('#table td:visible').length, 0, "hidden cell children not perceived as visible");
jQuery("#table").css("display", "none").html("<tr><td>cell</td><td>cell</td></tr>");
equals(jQuery("#table td:visible").length, 0, "hidden cell children not perceived as visible");
});
test("internal ref to elem.runtimeStyle (bug #7608)", function () {