1 // Use the right jQuery source on the test page (and iframes)
3 /* global loadTests: false */
5 var FILEPATH = "/test/jquery.js",
6 activeScript = [].slice.call( document.getElementsByTagName( "script" ), -1 )[ 0 ],
7 parentUrl = activeScript && activeScript.src ?
8 activeScript.src.replace( /[?#].*/, "" ) + FILEPATH.replace( /[^/]+/g, ".." ) + "/" :
10 QUnit = window.QUnit || parent.QUnit,
11 require = window.require || parent.require,
13 // Default to unminified jQuery for directly-opened iframes
21 // Define configuration parameters controlling how jQuery is loaded
24 // AMD loading is asynchronous and incompatible with synchronous test loading in Karma
25 if ( !window.__karma__ ) {
26 QUnit.config.urlConfig.push( {
28 label: "Load with AMD",
29 tooltip: "Load the AMD jQuery file (and its dependencies)"
33 QUnit.config.urlConfig.push( {
35 label: "Load unminified",
36 tooltip: "Load the development (unminified) jQuery file"
40 // Honor AMD loading on the main window (detected by seeing QUnit on it).
41 // This doesn't apply to iframes because they synchronously expect jQuery to be there.
42 if ( urlParams.amd && window.QUnit ) {
48 // Include tests if specified
49 if ( typeof loadTests !== "undefined" ) {
50 require( [ src ], loadTests );
55 // Otherwise, load synchronously
57 document.write( "<script id='jquery-js' nonce='jquery+hardcoded+nonce' src='" + parentUrl + src + "'><\x2Fscript>" );