Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2150 mathias 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");
4
 
5
tests.register("tests._base._loader.loader",
6
	[
7
		function baseUrl(t){
8
			var originalBaseUrl = djConfig["baseUrl"] || "./";
9
 
10
			t.assertEqual(originalBaseUrl, dojo.baseUrl);
11
		},
12
 
13
		function modulePaths(t){
14
			dojo.registerModulePath("mycoolmod", "../some/path/mycoolpath");
15
			dojo.registerModulePath("mycoolmod.widget", "http://some.domain.com/another/path/mycoolpath/widget");
16
 
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("/"));
20
		},
21
 
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");
26
 
27
 
28
			var basePrefix = dojo.baseUrl;
29
			//dojo._Uri will strip off "./" characters, so do the same here
30
			if(basePrefix == "./"){
31
				basePrefix = "";
32
			}
33
 
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());
38
 
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());
43
 
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());
48
		}
49
	]
50
);
51
 
52
}