diff options
Diffstat (limited to 'test/jquery.js')
-rw-r--r-- | test/jquery.js | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/test/jquery.js b/test/jquery.js index d6d53fb26..c34c7c491 100644 --- a/test/jquery.js +++ b/test/jquery.js @@ -28,7 +28,12 @@ QUnit.config.urlConfig.push( { id: "esmodules", label: "Load as modules", - tooltip: "Load a relevant jQuery module file (and its dependencies)" + tooltip: "Load the jQuery module file (and its dependencies)" + } ); + QUnit.config.urlConfig.push( { + id: "amd", + label: "Load with AMD", + tooltip: "Load the AMD jQuery file (and its dependencies)" } ); } @@ -39,7 +44,7 @@ } ); } - // Honor AMD loading on the main window (detected by seeing QUnit on it). + // Honor ES modules loading on the main window (detected by seeing QUnit on it). // This doesn't apply to iframes because they synchronously expect jQuery to be there. if ( urlParams.esmodules && window.QUnit ) { @@ -57,6 +62,20 @@ eval( dynamicImportSource ); + // Apply similar treatment for AMD modules + } else if ( urlParams.amd && window.QUnit ) { + require.config( { + baseUrl: parentUrl + } ); + src = "amd/jquery"; + + // Include tests if specified + if ( typeof loadTests !== "undefined" ) { + require( [ src ], loadTests ); + } else { + require( [ src ] ); + } + // Otherwise, load synchronously } else { document.write( "<script id='jquery-js' nonce='jquery+hardcoded+nonce' src='" + parentUrl + src + "'><\x2Fscript>" ); |