config-sniff-djConfig.html 1.4 KB
<html>
<head>
    <!--
		NOTE: this test is exactly the same as config-sniff except the attribute is renamed to djConfig
	-->
	<script type="text/javascript">
		var hasAlias;
		var dojoConfig= {
			async:1,
			waitSeconds:5
		};
	</script>
	<script 
		type="text/javascript" 
		src="../../../dojo.js"
		djConfig="isDebug:1, async:1, waitSeconds:6, baseUrl:'../../../../dojo', cats:'dojo-config-dogs', a:2, b:[3,4,5]"></script>
	<script type="text/javascript">
		require(["dojo", "doh", "dojo/has"], function(dojo, doh, has) {
			dojo.ready(function() {
				hasAlias= has;
				doh.register("dojoConfig-sniff-test", [
					function expectDojoConfig(t) {
						// show that sniff overrides dojoConfig
						t.is(require.rawConfig.async, true);
						t.is(require.rawConfig.baseUrl, "../../../../dojo");
						t.is(require.rawConfig.waitSeconds, 6);
						t.is(require.rawConfig.cats, 'dojo-config-dogs');
						t.is(require.rawConfig.a, 2);
						t.is(require.rawConfig.b, [3,4,5]);

						t.is(require.async, true);
						t.is(require.baseUrl, "../../../../dojo/");
						t.is(require.cats, undefined);
						t.is(require.a, undefined);
						t.is(require.b, undefined);

						t.is(dojo.config.baseUrl, "../../../../dojo/");
						t.is(dojo.config.cats, 'dojo-config-dogs');
						t.is(dojo.config.a, 2);
						t.is(dojo.config.b, [3,4,5]);			
					}
				]);
				doh.runOnLoad();
			});
		});
	</script>
</head>
<body>
</body>
</html>