1 | <html> |
---|
2 | <head> |
---|
3 | <script type="text/javascript"> |
---|
4 | var hasAlias, dojoAlias; |
---|
5 | var _dojoConfig= { |
---|
6 | baseUrl:"../../../../dojo", |
---|
7 | waitSeconds:5, |
---|
8 | locale:"us-en1", |
---|
9 | has:{ |
---|
10 | configTestHas1:1 |
---|
11 | }, |
---|
12 | cats:'dojo-config-dogs', |
---|
13 | a:2, |
---|
14 | b:[3,4,5] |
---|
15 | }; |
---|
16 | function expectDojoConfig(t) { |
---|
17 | t.is(require.rawConfig.baseUrl, "../../../../dojo"); |
---|
18 | t.is(require.rawConfig.waitSeconds, 5); |
---|
19 | t.is(require.rawConfig.locale,"us-en1"); |
---|
20 | t.is(require.rawConfig.has, _dojoConfig.has); |
---|
21 | t.is(require.rawConfig.cats, 'dojo-config-dogs'); |
---|
22 | t.is(require.rawConfig.a, 2); |
---|
23 | t.is(require.rawConfig.b, [3,4,5]); |
---|
24 | |
---|
25 | t.is(require.baseUrl, "../../../../dojo/"); |
---|
26 | t.t(hasAlias("configTestHas1")); |
---|
27 | t.is(require.cats, undefined); |
---|
28 | t.is(require.a, undefined); |
---|
29 | t.is(require.b, undefined); |
---|
30 | |
---|
31 | t.is(dojo.config.baseUrl, "../../../../dojo/"); |
---|
32 | t.is(dojo.config.waitSeconds, 5); |
---|
33 | t.is(dojo.config.locale,"us-en1"); |
---|
34 | t.is(dojo.config.cats, 'dojo-config-dogs'); |
---|
35 | t.is(dojo.config.a, 2); |
---|
36 | t.is(dojo.config.b, [3,4,5]); |
---|
37 | } |
---|
38 | |
---|
39 | var _djConfig= { |
---|
40 | baseUrl:"../../../../dojo", |
---|
41 | waitSeconds:6, |
---|
42 | locale:"us-en2", |
---|
43 | has:{ |
---|
44 | configTestHas2:1 |
---|
45 | }, |
---|
46 | cats:'dj-config-dogs', |
---|
47 | a:6, |
---|
48 | b:[7,8,9] |
---|
49 | }; |
---|
50 | function expectDjConfig(t) { |
---|
51 | t.is(require.rawConfig.baseUrl, "../../../../dojo"); |
---|
52 | t.is(require.rawConfig.waitSeconds, 6); |
---|
53 | t.is(require.rawConfig.locale,"us-en2"); |
---|
54 | t.is(require.rawConfig.has, _djConfig.has); |
---|
55 | t.is(require.rawConfig.cats, 'dj-config-dogs'); |
---|
56 | t.is(require.rawConfig.a, 6); |
---|
57 | t.is(require.rawConfig.b, [7,8,9]); |
---|
58 | |
---|
59 | t.is(require.baseUrl, "../../../../dojo/"); |
---|
60 | t.t(hasAlias("configTestHas2")); |
---|
61 | t.is(require.cats, undefined); |
---|
62 | t.is(require.a, undefined); |
---|
63 | t.is(require.b, undefined); |
---|
64 | |
---|
65 | t.is(dojo.config.baseUrl, "../../../../dojo/"); |
---|
66 | t.is(dojo.config.waitSeconds, 6); |
---|
67 | t.is(dojo.config.locale,"us-en2"); |
---|
68 | t.is(dojo.config.cats, 'dj-config-dogs'); |
---|
69 | t.is(dojo.config.a, 6); |
---|
70 | t.is(dojo.config.b, [7,8,9]); |
---|
71 | } |
---|
72 | |
---|
73 | var _require= { |
---|
74 | baseUrl:"../../../../dojo", |
---|
75 | waitSeconds:7, |
---|
76 | locale:"us-en3", |
---|
77 | has:{ |
---|
78 | configTestHas3:1 |
---|
79 | }, |
---|
80 | cats:'require-config-dogs', |
---|
81 | a:10, |
---|
82 | b:[11,12,13] |
---|
83 | }; |
---|
84 | function expectRequireConfig(t) { |
---|
85 | t.is(require.rawConfig.baseUrl, "../../../../dojo"); |
---|
86 | t.is(require.rawConfig.waitSeconds, 7); |
---|
87 | t.is(require.rawConfig.locale,"us-en3"); |
---|
88 | t.is(require.rawConfig.has, _require.has); |
---|
89 | t.is(require.rawConfig.cats, 'require-config-dogs'); |
---|
90 | t.is(require.rawConfig.a, 10); |
---|
91 | t.is(require.rawConfig.b, [11,12,13]); |
---|
92 | |
---|
93 | t.is(require.baseUrl, "../../../../dojo/"); |
---|
94 | t.t(hasAlias("configTestHas3")); |
---|
95 | t.is(require.cats, undefined); |
---|
96 | t.is(require.a, undefined); |
---|
97 | t.is(require.b, undefined); |
---|
98 | |
---|
99 | t.is(dojo.config.baseUrl, "../../../../dojo/"); |
---|
100 | t.is(dojo.config.waitSeconds, 7); |
---|
101 | t.is(dojo.config.locale,"us-en3"); |
---|
102 | t.is(dojo.config.cats, 'require-config-dogs'); |
---|
103 | t.is(dojo.config.a, 10); |
---|
104 | t.is(dojo.config.b, [11,12,13]); |
---|
105 | } |
---|
106 | switch(location.search){ |
---|
107 | case "?dojoConfig-djConfig-require": |
---|
108 | dojoConfig= _dojoConfig; |
---|
109 | djConfig= _djConfig; |
---|
110 | require= _require; |
---|
111 | expect= expectDojoConfig; |
---|
112 | break; |
---|
113 | case "?dojoConfig-djConfig": |
---|
114 | dojoConfig= _dojoConfig; |
---|
115 | djConfig= _djConfig; |
---|
116 | expect= expectDojoConfig; |
---|
117 | break; |
---|
118 | case "?dojoConfig-require": |
---|
119 | dojoConfig= _dojoConfig; |
---|
120 | require= _require; |
---|
121 | expect= expectDojoConfig; |
---|
122 | break; |
---|
123 | case "?djConfig-require": |
---|
124 | djConfig= _djConfig; |
---|
125 | require= _require; |
---|
126 | expect= expectDjConfig; |
---|
127 | break; |
---|
128 | case "?djConfig": |
---|
129 | djConfig= _djConfig; |
---|
130 | expect= expectDjConfig; |
---|
131 | break; |
---|
132 | case "?require": |
---|
133 | require= _require; |
---|
134 | expect= expectRequireConfig; |
---|
135 | break; |
---|
136 | case "?dojoConfig": |
---|
137 | dojoConfig= _dojoConfig; |
---|
138 | expect= expectDojoConfig; |
---|
139 | break; |
---|
140 | } |
---|
141 | </script> |
---|
142 | <script type="text/javascript" src="../../../dojo.js" data-dojo-config="isDebug:1, async:1"></script> |
---|
143 | <script type="text/javascript"> |
---|
144 | require(["dojo", "doh", "dojo/has"], function(dojo, doh, has) { |
---|
145 | dojo.ready(function() { |
---|
146 | dojoAlias= dojo; |
---|
147 | hasAlias= has; |
---|
148 | doh.register("dojoConfig-test", [expect]); |
---|
149 | doh.runOnLoad(); |
---|
150 | }); |
---|
151 | }); |
---|
152 | </script> |
---|
153 | </head> |
---|
154 | <body> |
---|
155 | </body> |
---|
156 | </html> |
---|