Tests: Add dummy modules when running basic tests

Without this, other modules don't appear in the QUnit module picker.

Ref 855b0c8c28
Closes gh-2582
This commit is contained in:
Richard Gibson 2015-09-08 15:56:08 -04:00
parent 99e8ff1baa
commit f9af896bb8

View File

@ -278,20 +278,14 @@ this.loadTests = function() {
// Get testSubproject from testrunner first // Get testSubproject from testrunner first
require( [ "data/testrunner.js" ], function() { require( [ "data/testrunner.js" ], function() {
var tests = [] var i = 0,
.concat( [ tests = [
// A special module with basic tests, meant for // A special module with basic tests, meant for
// not fully supported environments like Android 2.3, // not fully supported environments like Android 2.3,
// jsdom or PhantomJS. We run it everywhere, though, // jsdom or PhantomJS. We run it everywhere, though,
// to make sure tests are not broken. // to make sure tests are not broken.
// "unit/basic.js",
// Support: Android 2.3 only
// When loading basic tests don't load any others to not
// overload Android 2.3.
"unit/basic.js"
] )
.concat( basicTests ? [] : [
"unit/core.js", "unit/core.js",
"unit/callbacks.js", "unit/callbacks.js",
"unit/deferred.js", "unit/deferred.js",
@ -312,14 +306,23 @@ this.loadTests = function() {
"unit/dimensions.js", "unit/dimensions.js",
"unit/animation.js", "unit/animation.js",
"unit/tween.js" "unit/tween.js"
] ); ];
// Ensure load order (to preserve test numbers) // Ensure load order (to preserve test numbers)
( function loadDep() { ( function loadDep() {
var dep = tests.shift(); var dep = tests[ i++ ];
if ( dep ) { if ( dep ) {
require( [ dep ], loadDep ); if ( !basicTests || i === 1 ) {
require( [ dep ], loadDep );
// Support: Android 2.3 only
// When running basic tests, replace other modules with dummies to avoid overloading
// impaired clients.
} else {
QUnit.module( dep.replace( /^.*\/|\.js$/g, "" ) );
loadDep();
}
} else { } else {
QUnit.load(); QUnit.load();