Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with priority config not triggering script fetching when it…
… was part of a data-main script load.
- Loading branch information
Showing
3 changed files
with
64 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
var master = new doh.Deferred(), | ||
count = 0; | ||
doh.register( | ||
"priority", | ||
[ | ||
{ | ||
name: "priority", | ||
timeout: 5000, | ||
runTest: function () { | ||
return master; | ||
} | ||
} | ||
] | ||
); | ||
doh.run(); | ||
|
||
require( | ||
{ | ||
baseUrl: "./", | ||
priority: ["one", "two"] | ||
}, | ||
["alpha", "beta", "gamma", "epsilon"], | ||
function (alpha, beta, gamma, epsilon) { | ||
count += 1; | ||
|
||
//Make sure callback is only called once. | ||
doh.is(1, count); | ||
|
||
doh.is("alpha", alpha.name); | ||
doh.is("beta", alpha.betaName); | ||
doh.is("beta", beta.name); | ||
doh.is("gamma", beta.gammaName); | ||
doh.is("gamma", gamma.name); | ||
doh.is("theta", gamma.thetaName); | ||
doh.is("epsilon", gamma.epsilonName); | ||
doh.is("epsilon", epsilon.name); | ||
} | ||
); | ||
|
||
function verifyFunc() { | ||
var regExp = /alpha|beta|gamma|theta/, | ||
i, | ||
scripts = document.getElementsByTagName("script"); | ||
for (i = scripts.length - 1; i > -1; i--) { | ||
doh.f(regExp.test(scripts[i].src)); | ||
} | ||
master.callback(true); | ||
} | ||
|
||
//Account for requiring this test with a version of require.js that | ||
//does not have require.ready built in. | ||
if (require.ready) { | ||
require.ready(verifyFunc); | ||
} else { | ||
setTimeout(verifyFunc, 3000); | ||
} |