Build: update grunt-jscs-checker and pass with the new rules

This commit is contained in:
Timmy Willison
2014-07-17 10:25:59 -07:00
parent 8e3a0ceafa
commit c869a1ef8a
39 changed files with 352 additions and 187 deletions

View File

@@ -224,7 +224,8 @@ this.testIframe = function( fileName, name, fn ) {
function loadFixture() {
var src = url( "./data/" + fileName + ".html" ),
iframe = jQuery( "<iframe />" ).appendTo( "body" )[ 0 ];
iframe.style.cssText = "width: 500px; height: 500px; position: absolute; top: -600px; left: -600px; visibility: hidden;";
iframe.style.cssText = "width: 500px; height: 500px; position: absolute; " +
"top: -600px; left: -600px; visibility: hidden;";
iframe.contentWindow.location = src;
return iframe;
@@ -304,7 +305,8 @@ this.loadTests = function() {
// Load the TestSwarm listener if swarmURL is in the address.
if ( loadSwarm ) {
require( [ "http://swarm.jquery.org/js/inject.js?" + (new Date()).getTime() ], function() {
require( [ "http://swarm.jquery.org/js/inject.js?" + (new Date()).getTime() ],
function() {
QUnit.start();
});
} else {

View File

@@ -25,12 +25,13 @@ QUnit.config.requireExpects = true;
* @param {string} key
*/
QUnit.expectJqData = function( elems, key ) {
var i, elem, expando;
var i, elem, expando,
currentEnv = "current_testEnvironment";
// As of jQuery 2.0, there will be no "cache"-data is
// stored and managed completely below the API surface
if ( jQuery.cache ) {
QUnit.current_testEnvironment.checkJqData = true;
QUnit[ currentEnv ].checkJqData = true;
if ( elems.jquery && elems.toArray ) {
elems = elems.toArray();
@@ -62,7 +63,12 @@ QUnit.expectJqData = function( elems, key ) {
// Since this method was called it means some data was
// expected to be found, but since there is nothing, fail early
// (instead of in teardown).
notStrictEqual( expando, undefined, "Target for expectJqData must have an expando, for else there can be no data to expect." );
notStrictEqual(
expando,
undefined,
"Target for expectJqData must have an expando, " +
"for else there can be no data to expect."
);
} else {
if ( expectedDataKeys[ expando ] ) {
expectedDataKeys[ expando ].push( key );
@@ -77,7 +83,8 @@ QUnit.expectJqData = function( elems, key ) {
QUnit.config.urlConfig.push({
id: "jqdata",
label: "Always check jQuery.data",
tooltip: "Trigger QUnit.expectJqData detection for all tests instead of just the ones that call it"
tooltip: "Trigger QUnit.expectJqData detection for all tests " +
"instead of just the ones that call it"
});
/**
@@ -102,7 +109,11 @@ window.moduleTeardown = function() {
}
// In case it was removed from cache before (or never there in the first place)
for ( i in expectedDataKeys ) {
deepEqual( expectedDataKeys[ i ], undefined, "No unexpected keys were left in jQuery.cache (#" + i + ")" );
deepEqual(
expectedDataKeys[ i ],
undefined,
"No unexpected keys were left in jQuery.cache (#" + i + ")"
);
delete expectedDataKeys[ i ];
}
}
@@ -130,8 +141,10 @@ window.moduleTeardown = function() {
++cacheLength;
}
// Because QUnit doesn't have a mechanism for retrieving the number of expected assertions for a test,
// if we unconditionally assert any of these, the test will fail with too many assertions :|
// Because QUnit doesn't have a mechanism for retrieving
// the number of expected assertions for a test,
// if we unconditionally assert any of these,
// the test will fail with too many assertions :|
if ( cacheLength !== oldCacheLength ) {
equal( cacheLength, oldCacheLength, "No unit tests leak memory in jQuery.cache" );
oldCacheLength = cacheLength;