Skip to content

Commit

Permalink
Reenable test support for AMD
Browse files Browse the repository at this point in the history
  • Loading branch information
gibson042 committed Sep 5, 2018
1 parent 88b8ff0 commit 782e643
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Gruntfile.js
Expand Up @@ -206,7 +206,8 @@ module.exports = function( grunt ) {
"test/unit/ready.js",

{ pattern: "dist/jquery.*", included: false, served: true },
{ pattern: "external/qunit/qunit.css", included: false, served: true },
{ pattern: "src/**", included: false, served: true },
{ pattern: "external/**", included: false, served: true },
{
pattern: "test/**/*.@(js|css|jpg|html|xml|svg)",
included: false,
Expand Down
12 changes: 9 additions & 3 deletions test/data/testinit.js
Expand Up @@ -299,12 +299,18 @@ moduleTypeSupported();
this.loadTests = function() {

// Directly load tests that need synchronous evaluation
if ( document.readyState !== "complete" ) {
if ( !QUnit.urlParams.amd || document.readyState === "loading" ) {
document.write( "<script src='" + parentUrl + "test/unit/ready.js'><\x2Fscript>" );
} else {
QUnit.module( "ready", function() {
QUnit.test( "jQuery ready", function( assert ) {
assert.ok( false, "Test should be initialized before DOM ready" );
} );
} );
}

// Get testSubproject from testrunner first
require( [ "data/testrunner.js" ], function() {
require( [ parentUrl + "test/data/testrunner.js" ], function() {
var i = 0,
tests = [
// A special module with basic tests, meant for
Expand Down Expand Up @@ -342,7 +348,7 @@ this.loadTests = function() {

if ( dep ) {
if ( !QUnit.basicTests || i === 1 ) {
require( [ dep ], loadDep );
require( [ parentUrl + "test/" + dep ], loadDep );

// Support: Android 2.3 only
// When running basic tests, replace other modules with dummies to avoid overloading
Expand Down

0 comments on commit 782e643

Please sign in to comment.