]> source.dussan.org Git - jquery-ui.git/commitdiff
Tests: Run JSHint.
authorScott González <scott.gonzalez@gmail.com>
Mon, 30 Apr 2012 00:22:31 +0000 (20:22 -0400)
committerScott González <scott.gonzalez@gmail.com>
Mon, 30 Apr 2012 00:22:52 +0000 (20:22 -0400)
tests/unit/core/core.js
tests/unit/effects/effects_core.js
tests/unit/position/position_core.js
tests/unit/testsuite.js
tests/unit/widget/widget_core.js

index 79d1d403457e4b420a5b63ffdad13c27129f476e..099ac468cde7df9e8d323f70c75f62c0649dce18 100644 (file)
@@ -2,6 +2,8 @@
 
 module( "core - jQuery extensions" );
 
+TestHelpers.testJshint( "ui.core" );
+
 test( "focus - original functionality", function() {
        expect( 1 );
        $( "#inputTabindex0" )
index 93c7da1141f29956ad71aed67a0afa855a4229e7..d3b5179e21cec2e2b46d23fdef6f4678c70b0a03 100644 (file)
@@ -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" ),
index e68e310f10cad173a6cd9d9b93bad7cf0c483512..4a2240311a6bf775cea57aa7c7be9e925ea62438 100644 (file)
@@ -16,6 +16,8 @@ module( "position", {
        }
 });
 
+TestHelpers.testJshint( "ui.position" );
+
 test( "my, at, of", function() {
        expect( 4 );
 
index faef90a9d010ac34f731107bb2d8d962d929741e..a6710930ba1636078ca7176ba962d774f889b54b 100644 (file)
@@ -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 );
index 38495e282116252644fb253c144b4b50bde162ae..aa70e24257e5e9c1a8c63f1d5214ba865943f54d 100644 (file)
@@ -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() {},