Skip to content

Commit 27072de

Browse files
committed
Tests: Run JSHint.
1 parent 24d978f commit 27072de

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

tests/unit/core/core.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
module( "core - jQuery extensions" );
44

5+
TestHelpers.testJshint( "ui.core" );
6+
57
test( "focus - original functionality", function() {
68
expect( 1 );
79
$( "#inputTabindex0" )

tests/unit/effects/effects_core.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,16 @@ asyncTest( "animateClass: css and class changes during animation are not lost (#
128128

129129

130130
$.each( $.effects.effect, function( effect ) {
131+
module( "effects." + effect );
132+
133+
// puff and size are defined inside scale
134+
if ( effect !== "puff" && effect !== "size" ) {
135+
TestHelpers.testJshint( "effects." + effect );
136+
}
137+
131138
if ( effect === "transfer" ) {
132139
return;
133140
}
134-
module( "effect."+effect );
135141
asyncTest( "show/hide", function() {
136142
expect( 8 );
137143
var hidden = $( "div.hidden" ),

tests/unit/position/position_core.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ module( "position", {
1616
}
1717
});
1818

19+
TestHelpers.testJshint( "ui.position" );
20+
1921
test( "my, at, of", function() {
2022
expect( 4 );
2123

tests/unit/testsuite.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,17 @@ TestHelpers.loadResources = QUnit.urlParams.min ?
2727
};
2828

2929
QUnit.config.urlConfig.push( "nojshint" );
30-
function testJshint( widget ) {
30+
var jshintLoaded = false;
31+
TestHelpers.testJshint = function( module ) {
3132
if ( QUnit.urlParams.nojshint ) {
3233
return;
3334
}
3435

35-
includeScript( "external/jshint.js" );
36+
if ( !jshintLoaded ) {
37+
includeScript( "external/jshint.js" );
38+
jshintLoaded = true;
39+
}
40+
3641
asyncTest( "JSHint", function() {
3742
expect( 1 );
3843

@@ -42,7 +47,7 @@ function testJshint( widget ) {
4247
dataType: "json"
4348
}),
4449
$.ajax({
45-
url: "../../../ui/jquery.ui." + widget + ".js",
50+
url: "../../../ui/jquery." + module + ".js",
4651
dataType: "text"
4752
})
4853
).done(function( hintArgs, srcArgs ) {
@@ -121,7 +126,7 @@ function testBasicUsage( widget ) {
121126
TestHelpers.commonWidgetTests = function( widget, settings ) {
122127
module( widget + ": common widget" );
123128

124-
testJshint( widget );
129+
TestHelpers.testJshint( "ui." + widget );
125130
testWidgetDefaults( widget, settings.defaults );
126131
testWidgetOverrides( widget );
127132
testBasicUsage( widget );

tests/unit/widget/widget_core.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
module( "widget factory", {
44
teardown: function() {
5-
delete $.ui.testWidget;
5+
if ( $.ui ) {
6+
delete $.ui.testWidget;
7+
}
68
}
79
});
810

11+
TestHelpers.testJshint( "ui.widget" );
12+
913
test( "widget creation", function() {
1014
var myPrototype = {
1115
_create: function() {},

0 commit comments

Comments
 (0)