cdnTest.html
3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<html>
<head>
<script src="../../../dojo.js"></script>
<script>
// dojo.i18n is always loaded as part of base on the xdomain build
dojo.require("dojo.i18n");
// now put the loader in xdomain mode; anything with amd will be detected to be xdomain
require.xdomainTest(function(name){
return /amd/.test(name);
});
// load the module that exercises all the load paths; keep a log of what happened
var dojoCdnTestLog= [];
dojo.require("dojo.tests._base.loader.cdnTest");
dojoCdnTestLog.push("after dojo.require(dojo.tests._base.loader.cdnTest)");
require(["dojo", "doh"], function(dojo, doh){
doh.register("cdn-test", [
function(t){
var expected= [
"loadInit in cdnTest",
"defining-dojo.tests._base.loader.amdModule1",
"defining-dojo.tests._base.loader.amdModuleDep1",
"in-dojo.tests._base.loader.syncModuleDep",
"out-dojo.tests._base.loader.syncModuleDep",
"in-dojo.tests._base.loader.syncModule",
"out-dojo.tests._base.loader.syncModule",
"after dojo.require(dojo.tests._base.loader.cdnTest)",
"defining-dojo.tests._base.loader.amdModule",
"defining-dojo.tests._base.loader.amdModuleDep",
"factory-dojo.tests._base.loader.amdModuleDep",
"factory-dojo.tests._base.loader.amdModule",
"in-dojo.tests._base.loader.cdnTest",
"in-dojo.tests._base.loader.syncModuleDep1",
"out-dojo.tests._base.loader.syncModuleDep1",
"in-dojo.tests._base.loader.syncModule1",
"out-dojo.tests._base.loader.syncModule1",
"factory-dojo.tests._base.loader.amdModuleDep1",
"factory-dojo.tests._base.loader.amdModule1",
"out-dojo.tests._base.loader.cdnTest"];
t.is(dojoCdnTestLog, expected);
t.is(dojo.tests._base.loader.syncModule.status, "OK");
t.is(dojo.tests._base.loader.syncModuleDep.status, "OK");
t.is(dojo.tests._base.loader.syncModule1.status, "OK");
t.is(dojo.tests._base.loader.syncModuleDep1.status, "OK");
t.is(require("dojo/tests/_base/loader/amdModule").status, "OK");
t.is(require("dojo/tests/_base/loader/amdModuleDep").status, "OK");
t.is(require("dojo/tests/_base/loader/amdModule1").status, "OK");
t.is(require("dojo/tests/_base/loader/amdModuleDep1").status, "OK");
t.is(dojo.tests._base.loader.syncModule2, undefined);
t.is(dojo.tests._base.loader.syncModuleDep2, undefined);
t.is(require("dojo/tests/_base/loader/amdModule2"), undefined);
t.is(require("dojo/tests/_base/loader/amdModuleDep2"), undefined);
t.is(dojo.i18n.getLocalization("dojo.tests._base.loader", "syncBundle").syncBundle, "syncBundle");
t.is(dojo.i18n.getLocalization("dojo.tests._base.loader", "syncBundle", "ab-cd-ef").syncBundle, "syncBundle-ab-cd-ef");
t.is(dojo.i18n.getLocalization("dojo.tests._base.loader", "amdBundle").amdBundle, "amdBundle");
t.is(dojo.i18n.getLocalization("dojo.tests._base.loader", "amdBundle", "ab-cd-ef").amdBundle, "amdBundle-ab-cd-ef");
}
]);
doh.runOnLoad();
dojo.ready(function(){
dojo.byId("done").innerHTML= dojoCdnTestLog.join("<br>");
});
});
</script>
</head>
<body>
<div id="done"></div>
</body>
</html>