mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Tests: Run JSHint in unit tests, unless nojshint=1 is specified in the query string.
This commit is contained in:
parent
822e1c5009
commit
3b54760b51
4390
external/jshint.js
vendored
Normal file
4390
external/jshint.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -24,8 +24,9 @@ function includeScript( url ) {
|
||||
|
||||
window.loadResources = min ?
|
||||
function() {
|
||||
includeStyle( "build/dist/theme/jquery-ui.min.css" );
|
||||
includeScript( "build/dist/jquery-ui.min.js" );
|
||||
// TODO: proper include with theme images
|
||||
includeStyle( "dist/jquery-ui.min.css" );
|
||||
includeScript( "dist/jquery-ui.min.js" );
|
||||
} :
|
||||
function( resources ) {
|
||||
$.each( resources.css || [], function( i, resource ) {
|
||||
|
@ -1,7 +1,41 @@
|
||||
(function() {
|
||||
(function( $ ) {
|
||||
|
||||
window.TestHelpers = {};
|
||||
|
||||
function testJshint( widget ) {
|
||||
if ( QUnit.urlParams.nojshint ) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.write( "<script src='../../../external/jshint.js'></script>" );
|
||||
asyncTest( "JSHint", function() {
|
||||
expect( 1 );
|
||||
|
||||
$.when(
|
||||
$.ajax({
|
||||
url: "../../../ui/.jshintrc",
|
||||
dataType: "json"
|
||||
}),
|
||||
$.ajax({
|
||||
url: "../../../ui/jquery.ui." + widget + ".js",
|
||||
dataType: "text"
|
||||
})
|
||||
).done(function( hintArgs, srcArgs ) {
|
||||
var passed = JSHINT( srcArgs[ 0 ], hintArgs[ 0 ] ),
|
||||
errors = $.map( JSHINT.errors, function( error ) {
|
||||
return "[L" + error.line + ":C" + error.character + "] " +
|
||||
error.reason + "\n" + error.evidence + "\n";
|
||||
}).join( "\n" );
|
||||
ok( passed, errors );
|
||||
start();
|
||||
})
|
||||
.fail(function() {
|
||||
ok( false, "error loading source" );
|
||||
start();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testWidgetDefaults( widget, defaults ) {
|
||||
var pluginDefaults = $.ui[ widget ].prototype.options;
|
||||
|
||||
@ -59,6 +93,7 @@ function testBasicUsage( widget ) {
|
||||
TestHelpers.commonWidgetTests = function( widget, settings ) {
|
||||
module( widget + ": common widget" );
|
||||
|
||||
testJshint( widget );
|
||||
testWidgetDefaults( widget, settings.defaults );
|
||||
testWidgetOverrides( widget );
|
||||
testBasicUsage( widget );
|
||||
@ -106,4 +141,4 @@ window.domEqual = function( selector, modifier, message ) {
|
||||
QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
|
||||
};
|
||||
|
||||
}());
|
||||
}( jQuery ));
|
||||
|
Loading…
Reference in New Issue
Block a user