Update jshintrc to conform to new style guide. Conform to onevar and unused in tests. Fixes #13755.

This commit is contained in:
Timmy Willison
2013-04-09 11:45:09 -04:00
parent 0afc92bd73
commit 0fa52c11cb
24 changed files with 769 additions and 657 deletions

View File

@@ -7,11 +7,13 @@ test("css(String|Hash)", function() {
equal( jQuery("#qunit-fixture").css("display"), "block", "Check for css property \"display\"" );
var $child = jQuery("#nothiddendivchild").css({ "width": "20%", "height": "20%" });
var $child, div, div2, width, height, child, prctval, checkval, old;
$child = jQuery("#nothiddendivchild").css({ "width": "20%", "height": "20%" });
notEqual( $child.css("width"), "20px", "Retrieving a width percentage on the child of a hidden div returns percentage" );
notEqual( $child.css("height"), "20px", "Retrieving a height percentage on the child of a hidden div returns percentage" );
var div = jQuery( "<div>" );
div = jQuery( "<div>" );
// These should be "auto" (or some better value)
// temporarily provide "0px" for backwards compat
@@ -23,7 +25,7 @@ test("css(String|Hash)", function() {
equal( div.css("width"), "4px", "Width on disconnected node." );
equal( div.css("height"), "4px", "Height on disconnected node." );
var div2 = jQuery( "<div style='display:none;'><input type='text' style='height:20px;'/><textarea style='height:20px;'/><div style='height:20px;'></div></div>").appendTo("body");
div2 = jQuery( "<div style='display:none;'><input type='text' style='height:20px;'/><textarea style='height:20px;'/><div style='height:20px;'></div></div>").appendTo("body");
equal( div2.find("input").css("height"), "20px", "Height on hidden input." );
equal( div2.find("textarea").css("height"), "20px", "Height on hidden textarea." );
@@ -34,7 +36,8 @@ test("css(String|Hash)", function() {
// handle negative numbers by setting to zero #11604
jQuery("#nothiddendiv").css( {"width": 1, "height": 1} );
var width = parseFloat(jQuery("#nothiddendiv").css("width")), height = parseFloat(jQuery("#nothiddendiv").css("height"));
width = parseFloat(jQuery("#nothiddendiv").css("width"));
height = parseFloat(jQuery("#nothiddendiv").css("height"));
jQuery("#nothiddendiv").css({ "overflow":"hidden", "width": -1, "height": -1 });
equal( parseFloat(jQuery("#nothiddendiv").css("width")), 0, "Test negative width set to 0");
equal( parseFloat(jQuery("#nothiddendiv").css("height")), 0, "Test negative height set to 0");
@@ -60,7 +63,7 @@ test("css(String|Hash)", function() {
equal( jQuery("#empty").css("opacity"), "1", "Assert opacity is taken from style attribute when set vs stylesheet in IE with filters" );
div = jQuery("#nothiddendiv");
var child = jQuery("#nothiddendivchild");
child = jQuery("#nothiddendivchild");
equal( parseInt(div.css("fontSize"), 10), 16, "Verify fontSize px set." );
equal( parseInt(div.css("font-size"), 10), 16, "Verify fontSize px set." );
@@ -76,7 +79,8 @@ test("css(String|Hash)", function() {
// Have to verify this as the result depends upon the browser's CSS
// support for font-size percentages
child.attr("class", "prct");
var prctval = parseInt(child.css("fontSize"), 10), checkval = 0;
prctval = parseInt(child.css("fontSize"), 10);
checkval = 0;
if ( prctval === 16 || prctval === 24 ) {
checkval = prctval;
}
@@ -85,7 +89,7 @@ test("css(String|Hash)", function() {
equal( typeof child.css("width"), "string", "Make sure that a string width is returned from css('width')." );
var old = child[0].style.height;
old = child[0].style.height;
// Test NaN
child.css("height", parseFloat("zoo"));
@@ -196,6 +200,7 @@ test("css() explicit and relative values", function() {
test("css(String, Object)", function() {
expect( 19 );
var j, div, display, ret, success;
jQuery("#nothiddendiv").css("top", "-1em");
ok( jQuery("#nothiddendiv").css("top"), -16, "Check negative number in EMs." );
@@ -215,22 +220,22 @@ test("css(String, Object)", function() {
equal( 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();
j = jQuery("#nonnodes").contents();
j.css("overflow", "visible");
equal( j.css("overflow"), "visible", "Check node,textnode,comment css works" );
// opera sometimes doesn't update 'display' correctly, see #2037
jQuery("#t2037")[0].innerHTML = jQuery("#t2037")[0].innerHTML;
equal( jQuery("#t2037 .hidden").css("display"), "none", "Make sure browser thinks it is hidden" );
var div = jQuery("#nothiddendiv"),
display = div.css("display"),
ret = div.css("display", undefined);
div = jQuery("#nothiddendiv");
display = div.css("display");
ret = div.css("display", undefined);
equal( ret, div, "Make sure setting undefined returns the original set." );
equal( div.css("display"), display, "Make sure that the display wasn't changed." );
// Test for Bug #5509
var success = true;
success = true;
try {
jQuery("#foo").css("backgroundColor", "rgba(0, 0, 0, 0.1)");
}
@@ -259,14 +264,15 @@ test( "css(Array)", function() {
test("css(String, Function)", function() {
expect(3);
var sizes = ["10px", "20px", "30px"];
var index,
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;
index = 0;
jQuery("#cssFunctionTest div").css("font-size", function() {
var size = sizes[index];
@@ -277,8 +283,8 @@ test("css(String, Function)", function() {
index = 0;
jQuery("#cssFunctionTest div").each(function() {
var computedSize = jQuery(this).css("font-size");
var expectedSize = sizes[index];
var computedSize = jQuery(this).css("font-size"),
expectedSize = sizes[index];
equal( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize );
index++;
});
@@ -289,14 +295,15 @@ test("css(String, Function)", function() {
test("css(String, Function) with incoming value", function() {
expect(3);
var sizes = ["10px", "20px", "30px"];
var index,
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;
index = 0;
jQuery("#cssFunctionTest div").css("font-size", function() {
var size = sizes[index];
@@ -319,14 +326,15 @@ test("css(String, Function) with incoming value", function() {
test("css(Object) where values are Functions", function() {
expect(3);
var sizes = ["10px", "20px", "30px"];
var index,
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;
index = 0;
jQuery("#cssFunctionTest div").css({"fontSize": function() {
var size = sizes[index];
@@ -337,8 +345,8 @@ test("css(Object) where values are Functions", function() {
index = 0;
jQuery("#cssFunctionTest div").each(function() {
var computedSize = jQuery(this).css("font-size");
var expectedSize = sizes[index];
var computedSize = jQuery(this).css("font-size"),
expectedSize = sizes[index];
equal( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize );
index++;
});
@@ -349,14 +357,15 @@ test("css(Object) where values are Functions", function() {
test("css(Object) where values are Functions with incoming values", function() {
expect(3);
var sizes = ["10px", "20px", "30px"];
var index,
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;
index = 0;
jQuery("#cssFunctionTest div").css({"fontSize": function() {
var size = sizes[index];
@@ -379,13 +388,15 @@ test("css(Object) where values are Functions with incoming values", function() {
test("show(); hide()", function() {
expect(22);
var hiddendiv = jQuery("div.hidden");
var hiddendiv, div, pass, old, test;
hiddendiv = jQuery("div.hidden");
hiddendiv.hide();
equal( hiddendiv.css("display"), "none", "Non-detached div hidden" );
hiddendiv.show();
equal( hiddendiv.css("display"), "block", "Pre-hidden div shown" );
var div = jQuery("<div>").hide();
div = jQuery("<div>").hide();
equal( div.css("display"), "none", "Detached div hidden" );
div.appendTo("#qunit-fixture").show();
equal( div.css("display"), "block", "Pre-hidden div shown" );
@@ -404,10 +415,10 @@ test("show(); hide()", function() {
hiddendiv.css("display","");
var pass = true;
pass = true;
div = jQuery("#qunit-fixture div");
div.show().each(function(){
if ( this.style.display == "none" ) {
if ( this.style.display === "none" ) {
pass = false;
}
});
@@ -416,10 +427,10 @@ test("show(); hide()", function() {
// #show-tests * is set display: none in CSS
jQuery("#qunit-fixture").append("<div id='show-tests'><div><p><a href='#'></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div><table id='test-table'></table>");
var old = jQuery("#test-table").show().css("display") !== "table";
old = jQuery("#test-table").show().css("display") !== "table";
jQuery("#test-table").remove();
var test = {
test = {
"div" : "block",
"p" : "block",
"a" : "inline",
@@ -567,7 +578,7 @@ test("show() resolves correct default display when iframe display:none #12904",
test("toggle()", function() {
expect(9);
var div,
var div, oldHide,
x = jQuery("#foo");
ok( x.is(":visible"), "is visible" );
@@ -589,7 +600,7 @@ test("toggle()", function() {
strictEqual( x.toggle().css( "display" ), "block", "is visible" );
// Ensure hide() is called when toggled (#12148)
var oldHide = jQuery.fn.hide;
oldHide = jQuery.fn.hide;
jQuery.fn.hide = function() {
ok( true, name + " method called on toggle" );
return oldHide.apply( this, arguments );
@@ -709,10 +720,12 @@ test("widows & orphans #8936", function () {
test("can't get css for disconnected in IE<9, see #10254 and #8388", function() {
expect( 2 );
var span = jQuery( "<span/>" ).css( "background-image", "url(data/1x1.jpg)" );
var span, div;
span = jQuery( "<span/>" ).css( "background-image", "url(data/1x1.jpg)" );
notEqual( span.css( "background-image" ), null, "can't get background-image in IE<9, see #10254" );
var div = jQuery( "<div/>" ).css( "top", 10 );
div = jQuery( "<div/>" ).css( "top", 10 );
equal( div.css( "top" ), "10px", "can't get top in IE<9, see #8388" );
});
@@ -844,9 +857,13 @@ test( "cssHooks - expand", function() {
test( "css opacity consistency across browsers (#12685)", function() {
expect( 4 );
var fixture = jQuery("#qunit-fixture"),
style = jQuery("<style>.opacityWithSpaces_t12685 { opacity: 0.1; filter: alpha(opacity = 10); } .opacityNoSpaces_t12685 { opacity: 0.2; filter: alpha(opacity=20); }</style>").appendTo(fixture),
el = jQuery("<div class='opacityWithSpaces_t12685'></div>").appendTo(fixture);
var el,
fixture = jQuery("#qunit-fixture");
// Append style element
jQuery("<style>.opacityWithSpaces_t12685 { opacity: 0.1; filter: alpha(opacity = 10); } .opacityNoSpaces_t12685 { opacity: 0.2; filter: alpha(opacity=20); }</style>").appendTo( fixture );
el = jQuery("<div class='opacityWithSpaces_t12685'></div>").appendTo(fixture);
equal( Math.round( el.css("opacity") * 100 ), 10, "opacity from style sheet (filter:alpha with spaces)" );
el.removeClass("opacityWithSpaces_t12685").addClass("opacityNoSpaces_t12685");