Docs: add gitter badge to README.md
[jquery.git] / test / jquery.js
blobd8eaf86293e5af362f9865d01b6f3a77609aeac9
1 // Use the right jQuery source on the test page (and iframes)
2 ( function() {
3 /* global loadTests: false */
5 var pathname = window.location.pathname,
6 path = pathname.slice( 0, pathname.lastIndexOf( "test" ) ),
7 QUnit = window.QUnit || parent.QUnit,
8 require = window.require || parent.require,
10 // Default to unminified jQuery for directly-opened iframes
11 urlParams = QUnit ?
12 QUnit.urlParams :
13 { dev: true },
14 src = urlParams.dev ?
15 "dist/jquery.js" :
16 "dist/jquery.min.js";
18 // Define configuration parameters controlling how jQuery is loaded
19 if ( QUnit ) {
20 QUnit.config.urlConfig.push( {
21 id: "amd",
22 label: "Load with AMD",
23 tooltip: "Load the AMD jQuery file (and its dependencies)"
24 } );
25 QUnit.config.urlConfig.push( {
26 id: "dev",
27 label: "Load unminified",
28 tooltip: "Load the development (unminified) jQuery file"
29 } );
32 // Honor AMD loading on the main window (detected by seeing QUnit on it).
33 // This doesn't apply to iframes because they synchronously expect jQuery to be there.
34 if ( urlParams.amd && window.QUnit ) {
35 require.config( {
36 baseUrl: path
37 } );
38 src = "src/jquery";
40 // Include tests if specified
41 if ( typeof loadTests !== "undefined" ) {
42 require( [ src ], loadTests );
43 } else {
44 require( [ src ] );
47 // Otherwise, load synchronously
48 } else {
49 document.write( "<script id='jquery-js' src='" + path + src + "'><\x2Fscript>" );
51 // Synchronous-only tests (other tests are loaded from the test page)
52 if ( typeof loadTests !== "undefined" ) {
53 document.write( "<script src='" + path + "test/unit/ready.js'><\x2Fscript>" );
57 } )();