diff options
author | Timmy Willison <timmywillisn@gmail.com> | 2013-09-06 15:44:50 -0400 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2013-09-06 17:23:45 -0400 |
commit | b99972de5896c88a6f3c02efb5d23ca98d8d461f (patch) | |
tree | de538243bfe83fdcee0df8131de4109a8f1d6ceb /test | |
parent | f044622bae3853abe8dc142585e9ba881b1c7ebd (diff) | |
download | jquery-b99972de5896c88a6f3c02efb5d23ca98d8d461f.tar.gz jquery-b99972de5896c88a6f3c02efb5d23ca98d8d461f.zip |
Use requirejs to load the testswarm inject script
Diffstat (limited to 'test')
-rw-r--r-- | test/data/testrunner.js | 14 | ||||
-rw-r--r-- | test/index.html | 17 |
2 files changed, 15 insertions, 16 deletions
diff --git a/test/data/testrunner.js b/test/data/testrunner.js index ea0eb014e..53d9f9017 100644 --- a/test/data/testrunner.js +++ b/test/data/testrunner.js @@ -373,17 +373,3 @@ QUnit.config.testTimeout = 20 * 1000; // 20 seconds // Enforce an "expect" argument or expect() call in all test bodies. QUnit.config.requireExpects = true; - -/** - * Load the TestSwarm listener if swarmURL is in the address. - */ -(function() { - var url = window.location.search; - url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + "swarmURL=".length ) ); - - if ( !url || url.indexOf("http") !== 0 ) { - return; - } - - document.write("<scr" + "ipt src='http://swarm.jquery.org/js/inject.js?" + (new Date()).getTime() + "'></scr" + "ipt>"); -})(); diff --git a/test/index.html b/test/index.html index 3636df471..49853c9ef 100644 --- a/test/index.html +++ b/test/index.html @@ -19,7 +19,9 @@ // Tests are always loaded async QUnit.config.autostart = false; function loadTests() { - var tests = [ + var loadSwarm, + url = window.location.search, + tests = [ "data/testrunner.js", "unit/core.js", "unit/callbacks.js", @@ -40,6 +42,9 @@ "unit/offset.js", "unit/dimensions.js" ]; + url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + "swarmURL=".length ) ); + loadSwarm = url && url.indexOf("http") === 0; + // Ensure load order (to preserve test numbers) (function loadDep() { var dep = tests.shift(); @@ -50,7 +55,15 @@ testSubproject( "Sizzle", "../bower_components/sizzle/test/", /^unit\/.*\.js$/, function() { // Call load to build module filter select element QUnit.load(); - QUnit.start(); + + // Load the TestSwarm listener if swarmURL is in the address. + if ( loadSwarm ) { + require( [ "http://swarm.jquery.org/js/inject.js?" + (new Date()).getTime() ], function() { + QUnit.start(); + }); + } else { + QUnit.start(); + } }); } })(); |