From 27072de09443eff51fdc6559658a7870c4d7824d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Sun, 29 Apr 2012 20:22:31 -0400 Subject: [PATCH] Tests: Run JSHint. --- tests/unit/core/core.js | 2 ++ tests/unit/effects/effects_core.js | 8 +++++++- tests/unit/position/position_core.js | 2 ++ tests/unit/testsuite.js | 13 +++++++++---- tests/unit/widget/widget_core.js | 6 +++++- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/tests/unit/core/core.js b/tests/unit/core/core.js index 79d1d4034..099ac468c 100644 --- a/tests/unit/core/core.js +++ b/tests/unit/core/core.js @@ -2,6 +2,8 @@ module( "core - jQuery extensions" ); +TestHelpers.testJshint( "ui.core" ); + test( "focus - original functionality", function() { expect( 1 ); $( "#inputTabindex0" ) diff --git a/tests/unit/effects/effects_core.js b/tests/unit/effects/effects_core.js index 93c7da114..d3b5179e2 100644 --- a/tests/unit/effects/effects_core.js +++ b/tests/unit/effects/effects_core.js @@ -128,10 +128,16 @@ asyncTest( "animateClass: css and class changes during animation are not lost (# $.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" ) { return; } - module( "effect."+effect ); asyncTest( "show/hide", function() { expect( 8 ); var hidden = $( "div.hidden" ), diff --git a/tests/unit/position/position_core.js b/tests/unit/position/position_core.js index e68e310f1..4a2240311 100644 --- a/tests/unit/position/position_core.js +++ b/tests/unit/position/position_core.js @@ -16,6 +16,8 @@ module( "position", { } }); +TestHelpers.testJshint( "ui.position" ); + test( "my, at, of", function() { expect( 4 ); diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index faef90a9d..a6710930b 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -27,12 +27,17 @@ TestHelpers.loadResources = QUnit.urlParams.min ? }; QUnit.config.urlConfig.push( "nojshint" ); -function testJshint( widget ) { +var jshintLoaded = false; +TestHelpers.testJshint = function( module ) { if ( QUnit.urlParams.nojshint ) { return; } - includeScript( "external/jshint.js" ); + if ( !jshintLoaded ) { + includeScript( "external/jshint.js" ); + jshintLoaded = true; + } + asyncTest( "JSHint", function() { expect( 1 ); @@ -42,7 +47,7 @@ function testJshint( widget ) { dataType: "json" }), $.ajax({ - url: "../../../ui/jquery.ui." + widget + ".js", + url: "../../../ui/jquery." + module + ".js", dataType: "text" }) ).done(function( hintArgs, srcArgs ) { @@ -121,7 +126,7 @@ function testBasicUsage( widget ) { TestHelpers.commonWidgetTests = function( widget, settings ) { module( widget + ": common widget" ); - testJshint( widget ); + TestHelpers.testJshint( "ui." + widget ); testWidgetDefaults( widget, settings.defaults ); testWidgetOverrides( widget ); testBasicUsage( widget ); diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js index 38495e282..aa70e2425 100644 --- a/tests/unit/widget/widget_core.js +++ b/tests/unit/widget/widget_core.js @@ -2,10 +2,14 @@ module( "widget factory", { teardown: function() { - delete $.ui.testWidget; + if ( $.ui ) { + delete $.ui.testWidget; + } } }); +TestHelpers.testJshint( "ui.widget" ); + test( "widget creation", function() { var myPrototype = { _create: function() {}, -- 2.39.5