Tests: Run JSHint.

This commit is contained in:
Scott González 2012-04-29 20:22:31 -04:00
parent 24d978f833
commit 27072de094
5 changed files with 25 additions and 6 deletions

View File

@ -2,6 +2,8 @@
module( "core - jQuery extensions" ); module( "core - jQuery extensions" );
TestHelpers.testJshint( "ui.core" );
test( "focus - original functionality", function() { test( "focus - original functionality", function() {
expect( 1 ); expect( 1 );
$( "#inputTabindex0" ) $( "#inputTabindex0" )

View File

@ -128,10 +128,16 @@ asyncTest( "animateClass: css and class changes during animation are not lost (#
$.each( $.effects.effect, function( effect ) { $.each( $.effects.effect, function( effect ) {
module( "effects." + effect );
// puff and size are defined inside scale
if ( effect !== "puff" && effect !== "size" ) {
TestHelpers.testJshint( "effects." + effect );
}
if ( effect === "transfer" ) { if ( effect === "transfer" ) {
return; return;
} }
module( "effect."+effect );
asyncTest( "show/hide", function() { asyncTest( "show/hide", function() {
expect( 8 ); expect( 8 );
var hidden = $( "div.hidden" ), var hidden = $( "div.hidden" ),

View File

@ -16,6 +16,8 @@ module( "position", {
} }
}); });
TestHelpers.testJshint( "ui.position" );
test( "my, at, of", function() { test( "my, at, of", function() {
expect( 4 ); expect( 4 );

View File

@ -27,12 +27,17 @@ TestHelpers.loadResources = QUnit.urlParams.min ?
}; };
QUnit.config.urlConfig.push( "nojshint" ); QUnit.config.urlConfig.push( "nojshint" );
function testJshint( widget ) { var jshintLoaded = false;
TestHelpers.testJshint = function( module ) {
if ( QUnit.urlParams.nojshint ) { if ( QUnit.urlParams.nojshint ) {
return; return;
} }
includeScript( "external/jshint.js" ); if ( !jshintLoaded ) {
includeScript( "external/jshint.js" );
jshintLoaded = true;
}
asyncTest( "JSHint", function() { asyncTest( "JSHint", function() {
expect( 1 ); expect( 1 );
@ -42,7 +47,7 @@ function testJshint( widget ) {
dataType: "json" dataType: "json"
}), }),
$.ajax({ $.ajax({
url: "../../../ui/jquery.ui." + widget + ".js", url: "../../../ui/jquery." + module + ".js",
dataType: "text" dataType: "text"
}) })
).done(function( hintArgs, srcArgs ) { ).done(function( hintArgs, srcArgs ) {
@ -121,7 +126,7 @@ function testBasicUsage( widget ) {
TestHelpers.commonWidgetTests = function( widget, settings ) { TestHelpers.commonWidgetTests = function( widget, settings ) {
module( widget + ": common widget" ); module( widget + ": common widget" );
testJshint( widget ); TestHelpers.testJshint( "ui." + widget );
testWidgetDefaults( widget, settings.defaults ); testWidgetDefaults( widget, settings.defaults );
testWidgetOverrides( widget ); testWidgetOverrides( widget );
testBasicUsage( widget ); testBasicUsage( widget );

View File

@ -2,10 +2,14 @@
module( "widget factory", { module( "widget factory", {
teardown: function() { teardown: function() {
delete $.ui.testWidget; if ( $.ui ) {
delete $.ui.testWidget;
}
} }
}); });
TestHelpers.testJshint( "ui.widget" );
test( "widget creation", function() { test( "widget creation", function() {
var myPrototype = { var myPrototype = {
_create: function() {}, _create: function() {},