mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Use requirejs to load the testswarm inject script
This commit is contained in:
parent
1a25f21dc3
commit
6535cc599e
@ -379,17 +379,3 @@ QUnit.config.testTimeout = 20 * 1000; // 20 seconds
|
|||||||
|
|
||||||
// Enforce an "expect" argument or expect() call in all test bodies.
|
// Enforce an "expect" argument or expect() call in all test bodies.
|
||||||
QUnit.config.requireExpects = true;
|
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>");
|
|
||||||
})();
|
|
||||||
|
@ -19,7 +19,9 @@
|
|||||||
// Tests are always loaded async
|
// Tests are always loaded async
|
||||||
QUnit.config.autostart = false;
|
QUnit.config.autostart = false;
|
||||||
function loadTests() {
|
function loadTests() {
|
||||||
var tests = [
|
var loadSwarm,
|
||||||
|
url = window.location.search,
|
||||||
|
tests = [
|
||||||
"data/testrunner.js",
|
"data/testrunner.js",
|
||||||
"unit/core.js",
|
"unit/core.js",
|
||||||
"unit/callbacks.js",
|
"unit/callbacks.js",
|
||||||
@ -40,6 +42,9 @@
|
|||||||
"unit/offset.js",
|
"unit/offset.js",
|
||||||
"unit/dimensions.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)
|
// Ensure load order (to preserve test numbers)
|
||||||
(function loadDep() {
|
(function loadDep() {
|
||||||
var dep = tests.shift();
|
var dep = tests.shift();
|
||||||
@ -50,7 +55,15 @@
|
|||||||
testSubproject( "Sizzle", "../bower_components/sizzle/test/", /^unit\/.*\.js$/, function() {
|
testSubproject( "Sizzle", "../bower_components/sizzle/test/", /^unit\/.*\.js$/, function() {
|
||||||
// Call load to build module filter select element
|
// Call load to build module filter select element
|
||||||
QUnit.load();
|
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();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user