1 if(!dojo._hasResource["tests._base._loader.loader"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["tests._base._loader.loader"] = true;
3 dojo.provide("tests._base._loader.loader");
5 tests.register("tests._base._loader.loader",
8 var originalBaseUrl = dojo.config["baseUrl"] || "./";
10 t.assertEqual(originalBaseUrl, dojo.baseUrl);
13 function modulePaths(t){
14 dojo.registerModulePath("mycoolmod", "../some/path/mycoolpath");
15 dojo.registerModulePath("mycoolmod.widget", "http://some.domain.com/another/path/mycoolpath/widget");
17 t.assertEqual("../some/path/mycoolpath/util", dojo._getModuleSymbols("mycoolmod.util").join("/"));
18 t.assertEqual("http://some.domain.com/another/path/mycoolpath/widget", dojo._getModuleSymbols("mycoolmod.widget").join("/"));
19 t.assertEqual("http://some.domain.com/another/path/mycoolpath/widget/thingy", dojo._getModuleSymbols("mycoolmod.widget.thingy").join("/"));
22 function moduleUrls(t){
23 dojo.registerModulePath("mycoolmod", "some/path/mycoolpath");
24 dojo.registerModulePath("mycoolmod2", "/some/path/mycoolpath2");
25 dojo.registerModulePath("mycoolmod.widget", "http://some.domain.com/another/path/mycoolpath/widget");
28 var basePrefix = dojo.baseUrl;
29 //dojo._Uri will strip off "./" characters, so do the same here
30 if(basePrefix == "./"){
34 t.assertEqual(basePrefix + "some/path/mycoolpath/my/favorite.html",
35 dojo.moduleUrl("mycoolmod", "my/favorite.html").toString());
36 t.assertEqual(basePrefix + "some/path/mycoolpath/my/favorite.html",
37 dojo.moduleUrl("mycoolmod.my", "favorite.html").toString());
39 t.assertEqual("/some/path/mycoolpath2/my/favorite.html",
40 dojo.moduleUrl("mycoolmod2", "my/favorite.html").toString());
41 t.assertEqual("/some/path/mycoolpath2/my/favorite.html",
42 dojo.moduleUrl("mycoolmod2.my", "favorite.html").toString());
44 t.assertEqual("http://some.domain.com/another/path/mycoolpath/widget/my/favorite.html",
45 dojo.moduleUrl("mycoolmod.widget", "my/favorite.html").toString());
46 t.assertEqual("http://some.domain.com/another/path/mycoolpath/widget/my/favorite.html",
47 dojo.moduleUrl("mycoolmod.widget.my", "favorite.html").toString());