cdnTest.html 3.06 KB
<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>