(function( $, QUnit ) {
$.extend( QUnit, {
testSuites: function( suites ) {
$.each( suites, function( i, suite ) {
asyncTest( suite, function() {
runSuite( suite );
});
});
},
testStart: function( data ) {
// update the test status to show which test suite is running
$( "#qunit-testresult" ).html( "Running " + data.name + "...
" );
},
testDone: function() {
// undo the auto-expansion of failed tests
$( "#qunit-tests > li.fail" ).each(function() {
var test = $( this );
// avoid collapsing test results that the user manually opened
if ( test.data( "auto-collapsed" ) ) {
return;
}
test.data( "auto-collapsed", true )
.children( "ol" ).hide();
});
}
});
// generate an iframe to run the test suite and proxy the iframe's QUnit
// to pass all test info to the main page
function runSuite( suite ) {
var body = $( "body" ),
iframe = $( "