diff options
author | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-13 09:49:11 +0000 |
---|---|---|
committer | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-13 09:49:11 +0000 |
commit | e44a7e37b6c7b5961adaffc62b9042b8d442938e (patch) | |
tree | 95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dojo/tests/_base/_loader | |
parent | a62b9742ee5e28bcec6872d88f50f25b820914f6 (diff) | |
download | semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2 |
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojo/tests/_base/_loader')
14 files changed, 703 insertions, 0 deletions
diff --git a/includes/js/dojo/tests/_base/_loader/addLoadEvents.html b/includes/js/dojo/tests/_base/_loader/addLoadEvents.html new file mode 100644 index 0000000..53e669f --- /dev/null +++ b/includes/js/dojo/tests/_base/_loader/addLoadEvents.html @@ -0,0 +1,37 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <title>Testing dojo.addOnLoad() and dojo.addOnUnload()</title> + <script type="text/javascript" + src="../../../dojo.js" djConfig="isDebug: true"></script> + <script type="text/javascript"> + dojo.addOnLoad(function(){ + console.debug("addOnLoad(func) works"); + }); + var scope = { + named: function(){ console.debug("addOnLoad(obj, name) works"); }, + refd: function(){ console.debug("addOnLoad(obj, func) works"); } + }; + dojo.addOnLoad(scope, "named"); + dojo.addOnLoad(scope, scope.refd); + // dojo.addOnLoad(scope, "named"); + // dojo.addOnLoad(scope, scope.refd); + + dojo.addOnUnload(function(){ + alert("addOnUnload works"); + }); + </script> + </head> + <body> + <h1>Testing dojo.addOnLoad() and dojo.addOnUnload()</h1> + + <p>This page has registers a function with dojo.addOnLoad() and dojo.addOnUnload.</p> + + <p><b>dojo.addOnLoad()</b>: You should see an alert with the page first loads ("addOnLoad works").</p> + + <p><b>dojo.addOnUnload()</b>: You should see an alert if the page is reloaded, or if you navigate to a + different web page ("addOnUnload works"). + </body> +</html> + diff --git a/includes/js/dojo/tests/_base/_loader/afterOnLoad.html b/includes/js/dojo/tests/_base/_loader/afterOnLoad.html new file mode 100644 index 0000000..48ebd60 --- /dev/null +++ b/includes/js/dojo/tests/_base/_loader/afterOnLoad.html @@ -0,0 +1,56 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <title>Testing afterOnLoad</title> + + <link rel="stylesheet" type="text/css" href="../../../resources/dojo.css" /> + <link rel="stylesheet" type="text/css" href="../../../../dijit/tests/css/dijitTests.css" /> + <link rel="stylesheet" type="text/css" href="../../../../dijit/themes/tundra/tundra.css" /> + + <script type="text/javascript"> + window.onload = function(){ + //Create global djConfig object first. We cannot use the djConfig attribute + //on the script tag since it may not be visible in some browsers at the time + //dojo.js executes. This causes problems when the "require" property is used + //as part of djConfig. Also note that you have to set baseUrl directly, since + //it cannot be detected as part of script tag. + djConfig = { + baseUrl: "../../../", + parseOnLoad: true, + afterOnLoad:true, + require: [ + 'dojo.parser', + 'dijit._Calendar' + ], + isDebug: true + }; + + var script = document.createElement("script"); + script.type = "text/javascript"; + script.src = "../../../dojo.js"; + + document.getElementsByTagName("head")[0].appendChild(script); + } + + function myHandler(id,newValue){ + console.debug("onChange for id = " + id + ", value: " + newValue); + } + </script> + </head> + <body> + <h1>Testing afterOnLoad</h1> + + <p><b>This page only works with a dojo build</b>. It will not work properly if you run it directly from the subversion source.</p> + + <p>This page tests loading dojo after the page is loaded. </p> + + <p>When the window.onload fires, the dojo script tag will be added to the DOM + and configured to fire the onload callbacks. If everything works, you should + see a Calendar below.</p> + + <p class="tundra"> + <input id="calendar1" dojoType="dijit._Calendar" onChange="myHandler(this.id,arguments[0])"> + </p> + </body> +</html> diff --git a/includes/js/dojo/tests/_base/_loader/bootstrap.js b/includes/js/dojo/tests/_base/_loader/bootstrap.js new file mode 100644 index 0000000..c2605cb --- /dev/null +++ b/includes/js/dojo/tests/_base/_loader/bootstrap.js @@ -0,0 +1,86 @@ +if(!dojo._hasResource["tests._base._loader.bootstrap"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests._base._loader.bootstrap"] = true; +dojo.provide("tests._base._loader.bootstrap"); + +tests.register("tests._base._loader.bootstrap", + [ + + function hasConsole(t){ + t.assertTrue("console" in dojo.global); + t.assertTrue("assert" in console); + t.assertEqual("function", typeof console.assert); + }, + + { + name: "getObject", + setUp: function(){ + //Set an object in global scope. + dojo.global.globalValue = { + color: "blue", + size: 20 + }; + + //Set up an object in a specific scope. + this.foo = { + bar: { + color: "red", + size: 100 + } + }; + }, + runTest: function(t){ + //Test for existing object using global as root path. + var globalVar = dojo.getObject("globalValue"); + t.is("object", (typeof globalVar)); + t.assertEqual("blue", globalVar.color); + t.assertEqual(20, globalVar.size); + t.assertEqual("blue", dojo.getObject("globalValue.color")); + + //Test for non-existent object using global as root path. + //Then create it. + t.assertFalse(dojo.getObject("something.thatisNew")); + t.assertTrue(typeof(dojo.getObject("something.thatisNew", true)) == "object"); + + //Test for existing object using another object as root path. + var scopedVar = dojo.getObject("foo.bar", false, this); + t.assertTrue(typeof(scopedVar) == "object"); + t.assertEqual("red", scopedVar.color); + t.assertEqual(100, scopedVar.size); + t.assertEqual("red", dojo.getObject("foo.bar.color", true, this)); + + //Test for existing object using another object as root path. + //Then create it. + t.assertFalse(dojo.getObject("something.thatisNew", false, this)); + t.assertTrue(typeof(dojo.getObject("something.thatisNew", true, this)) == "object"); + }, + tearDown: function(){ + //Clean up global object that should not exist if + //the test is re-run. + try{ + delete dojo.global.something; + delete this.something; + }catch(e){} + } + }, + + { + name: "exists", + setUp: function(){ + this.foo = { + bar: {} + }; + }, + runTest: function(t){ + t.assertTrue(dojo.exists("foo.bar", this)); + t.assertFalse(dojo.exists("foo.bar")); + } + }, + + function evalWorks(t){ + t.assertTrue(dojo.eval("(true)")); + t.assertFalse(dojo.eval("(false)")); + } + ] +); + +} diff --git a/includes/js/dojo/tests/_base/_loader/getText.txt b/includes/js/dojo/tests/_base/_loader/getText.txt new file mode 100644 index 0000000..054e8e8 --- /dev/null +++ b/includes/js/dojo/tests/_base/_loader/getText.txt @@ -0,0 +1 @@ +dojo._getText() test data
\ No newline at end of file diff --git a/includes/js/dojo/tests/_base/_loader/hostenv_browser.js b/includes/js/dojo/tests/_base/_loader/hostenv_browser.js new file mode 100644 index 0000000..255fca5 --- /dev/null +++ b/includes/js/dojo/tests/_base/_loader/hostenv_browser.js @@ -0,0 +1,15 @@ +if(!dojo._hasResource["tests._base._loader.hostenv_browser"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests._base._loader.hostenv_browser"] = true; +dojo.provide("tests._base._loader.hostenv_browser"); + +tests.register("tests._base._loader.hostenv_browser", + [ + function getText(t){ + var filePath = dojo.moduleUrl("tests._base._loader", "getText.txt"); + var text = dojo._getText(filePath); + t.assertEqual("dojo._getText() test data", text); + } + ] +); + +} diff --git a/includes/js/dojo/tests/_base/_loader/hostenv_rhino.js b/includes/js/dojo/tests/_base/_loader/hostenv_rhino.js new file mode 100644 index 0000000..c121576 --- /dev/null +++ b/includes/js/dojo/tests/_base/_loader/hostenv_rhino.js @@ -0,0 +1,17 @@ +if(!dojo._hasResource["tests._base._loader.hostenv_rhino"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests._base._loader.hostenv_rhino"] = true; +dojo.provide("tests._base._loader.hostenv_rhino"); + +tests.register("tests._base._loader.hostenv_rhino", + [ + function getText(t){ + var filePath = dojo.moduleUrl("tests._base._loader", "getText.txt"); + var text = (new String(readText(filePath))); + //The Java file read seems to add a line return. + text = text.replace(/[\r\n]+$/, ""); + t.assertEqual("dojo._getText() test data", text); + } + ] +); + +} diff --git a/includes/js/dojo/tests/_base/_loader/hostenv_spidermonkey.js b/includes/js/dojo/tests/_base/_loader/hostenv_spidermonkey.js new file mode 100644 index 0000000..980d624 --- /dev/null +++ b/includes/js/dojo/tests/_base/_loader/hostenv_spidermonkey.js @@ -0,0 +1,15 @@ +if(!dojo._hasResource["tests._base._loader.hostenv_spidermonkey"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests._base._loader.hostenv_spidermonkey"] = true; +dojo.provide("tests._base._loader.hostenv_spidermonkey"); + +tests.register("tests._base._loader.hostenv_spidermonkey", + [ + function getText(t){ + var filePath = dojo.moduleUrl("tests._base._loader", "getText.txt"); + var text = readText(filePath); + t.assertEqual("dojo._getText() test data", text); + } + ] +); + +} diff --git a/includes/js/dojo/tests/_base/_loader/loader.js b/includes/js/dojo/tests/_base/_loader/loader.js new file mode 100644 index 0000000..af1a338 --- /dev/null +++ b/includes/js/dojo/tests/_base/_loader/loader.js @@ -0,0 +1,52 @@ +if(!dojo._hasResource["tests._base._loader.loader"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests._base._loader.loader"] = true; +dojo.provide("tests._base._loader.loader"); + +tests.register("tests._base._loader.loader", + [ + function baseUrl(t){ + var originalBaseUrl = dojo.config["baseUrl"] || "./"; + + t.assertEqual(originalBaseUrl, dojo.baseUrl); + }, + + function modulePaths(t){ + dojo.registerModulePath("mycoolmod", "../some/path/mycoolpath"); + dojo.registerModulePath("mycoolmod.widget", "http://some.domain.com/another/path/mycoolpath/widget"); + + t.assertEqual("../some/path/mycoolpath/util", dojo._getModuleSymbols("mycoolmod.util").join("/")); + t.assertEqual("http://some.domain.com/another/path/mycoolpath/widget", dojo._getModuleSymbols("mycoolmod.widget").join("/")); + t.assertEqual("http://some.domain.com/another/path/mycoolpath/widget/thingy", dojo._getModuleSymbols("mycoolmod.widget.thingy").join("/")); + }, + + function moduleUrls(t){ + dojo.registerModulePath("mycoolmod", "some/path/mycoolpath"); + dojo.registerModulePath("mycoolmod2", "/some/path/mycoolpath2"); + dojo.registerModulePath("mycoolmod.widget", "http://some.domain.com/another/path/mycoolpath/widget"); + + + var basePrefix = dojo.baseUrl; + //dojo._Uri will strip off "./" characters, so do the same here + if(basePrefix == "./"){ + basePrefix = ""; + } + + t.assertEqual(basePrefix + "some/path/mycoolpath/my/favorite.html", + dojo.moduleUrl("mycoolmod", "my/favorite.html").toString()); + t.assertEqual(basePrefix + "some/path/mycoolpath/my/favorite.html", + dojo.moduleUrl("mycoolmod.my", "favorite.html").toString()); + + t.assertEqual("/some/path/mycoolpath2/my/favorite.html", + dojo.moduleUrl("mycoolmod2", "my/favorite.html").toString()); + t.assertEqual("/some/path/mycoolpath2/my/favorite.html", + dojo.moduleUrl("mycoolmod2.my", "favorite.html").toString()); + + t.assertEqual("http://some.domain.com/another/path/mycoolpath/widget/my/favorite.html", + dojo.moduleUrl("mycoolmod.widget", "my/favorite.html").toString()); + t.assertEqual("http://some.domain.com/another/path/mycoolpath/widget/my/favorite.html", + dojo.moduleUrl("mycoolmod.widget.my", "favorite.html").toString()); + } + ] +); + +} diff --git a/includes/js/dojo/tests/_base/_loader/scope/scope04.html b/includes/js/dojo/tests/_base/_loader/scope/scope04.html new file mode 100644 index 0000000..1866e4a --- /dev/null +++ b/includes/js/dojo/tests/_base/_loader/scope/scope04.html @@ -0,0 +1,80 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <title>Multiversion Dojo: 0.4.3 and 1.0</title> + + <link rel="stylesheet" type="text/css" href="../../../../resources/dojo.css" /> + <link rel="stylesheet" type="text/css" href="../../../../../dijit/css/dijitTests.css" /> + <link rel="stylesheet" type="text/css" href="../../../../../dijit/themes/tundra/tundra.css" /> + + <script type="text/javascript"> + //djConfig for 0.4.3 setup. + djConfig = { + isDebug: true + }; + </script> + <script type="text/javascript" src="http://o.aolcdn.com/dojo/0.4.3/dojo.js"></script> + + <script type="text/javascript"> + //Need scope map defined in a script block. It will not work as part of the + //djConfig attribute on the script that loads Dojo. + //Also, just adding properties instead of redefining djConfig, since that + //will wipe out djConfig values set up by the 0.4.3 dojo. + djConfig.parseOnLoad = true; + djConfig.baseUrl = "../../../../"; + djConfig.scopeMap = [ + ["dojo", "dojo10"], + ["dijit", "dijit10"], + ["dojox", "dojox10"] + ]; + </script> + <script type="text/javascript" src="../../../../dojo.js"></script> + <script type="text/javascript"> + dojo.require("dojo.widget.DropdownDatePicker"); + dojo10.require("dijit._Calendar"); + dojo10.require("dojo.date.locale"); + dojo10.require("dojo.parser"); // scan page for widgets + + dojo.addOnLoad(function(){ + dojo.byId("output043").innerHTML = dojo.version.toString(); + }); + dojo10.addOnLoad(function(){ + dojo.byId("output10").innerHTML = dojo10.version.toString(); + }); + + function myHandler(id,newValue){ + console.debug("onChange for id = " + id + ", value: " + newValue); + } + + function foobar(){ + dojo.byId("typeOut").innerHTML = (typeof dojo.addClass); + } + setTimeout(foobar, 2000); + + </script> + </head> + <body> + <h1>Multiversion Dojo: 0.4.3 and 1.0</h1> + + <p><b>NOTE: This test only works with a built version of Dojo</b></p> + + <p>This page loads Dojo 0.4.3 and Dojo 1.0.</p> + + <p>Dojo 0.4.3 version: <span id="output043"></span></p> + + <p>Dojo 1.0 version: <span id="output10"></span></p> + + <p><b>dojo.addClass should be undefined:</b> <span id="typeOut"></span></p> + + <p> + <input dojoType="dropdowndatepicker" value="2006-10-31" containerToggle="wipe" containerToggleDuration="300" > + </p> + + <p class="tundra"> + <input id="calendar1" dojo10Type="dijit._Calendar" onChange="myHandler(this.id,arguments[0])"> + </p> + + </body> +</html> + diff --git a/includes/js/dojo/tests/_base/_loader/scope/scopeContained.html b/includes/js/dojo/tests/_base/_loader/scope/scopeContained.html new file mode 100644 index 0000000..0acea5b --- /dev/null +++ b/includes/js/dojo/tests/_base/_loader/scope/scopeContained.html @@ -0,0 +1,71 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <title>Multiversion Dojo: 0.4.3 and 1.0</title> + + <link rel="stylesheet" type="text/css" href="../../../../resources/dojo.css" /> + <link rel="stylesheet" type="text/css" href="../../../../../dijit/css/dijitTests.css" /> + <link rel="stylesheet" type="text/css" href="../../../../../dijit/themes/tundra/tundra.css" /> + + <script type="text/javascript"> + //djConfig for 0.4.3 setup. + djConfig = { + isDebug: true + }; + </script> + <script type="text/javascript" src="http://o.aolcdn.com/dojo/0.4.3/dojo.js"></script> + + <script type="text/javascript"> + //Scope map for this page is "burned in" via a build command (see HTML notes below). + //Also, just adding properties instead of redefining djConfig, since that + //will wipe out djConfig values set up by the 0.4.3 dojo. + djConfig.parseOnLoad = true; + djConfig.baseUrl = "../../../../"; + </script> + <script type="text/javascript" src="../../../../dojo.js"></script> + <script type="text/javascript"> + dojo.require("dojo.widget.DropdownDatePicker"); + + //Notice that dijit._Calendar is required, not jidit._Calendar. + //Same for the dojo resources (not jodo resources). + jodo.require("dijit._Calendar"); + jodo.require("dojo.date.locale"); + jodo.require("dojo.parser"); // scan page for widgets + + dojo.addOnLoad(function(){ + dojo.byId("output043").innerHTML = dojo.version.toString(); + }); + jodo.addOnLoad(function(){ + dojo.byId("output10").innerHTML = jodo.version.toString(); + }); + + function myHandler(id,newValue){ + console.debug("onChange for id = " + id + ", value: " + newValue); + } + </script> + </head> + <body> + <h1>Multiversion Dojo: 0.4.3 and 1.0</h1> + + <p><b>NOTE: This test only works with a built version of Dojo, and it must be built with the scopeMap parameter (the backslashes below are required):</b></p> + + <p style="color: blue; background-color: yellow">build.sh profile=standard action=release scopeMap=[[\"dojo\",\"jodo\"],[\"dijit\",\"jidit\"],[\"dojox\",\"jodox\"]]</p> + + <p>This page loads Dojo 0.4.3 and Dojo 1.0 (under the jodo scope)</p> + + <p>Dojo 0.4.3 version: <span id="output043"></span></p> + + <p>Jodo version: <span id="output10"></span></p> + + <p> + <input dojoType="dropdowndatepicker" value="2006-10-31" containerToggle="wipe" containerToggleDuration="300" > + </p> + + <p class="tundra"> + <input id="calendar1" jodoType="dijit._Calendar" onChange="myHandler(this.id,arguments[0])"> + </p> + + </body> +</html> + diff --git a/includes/js/dojo/tests/_base/_loader/scope/scopeContainedXd.html b/includes/js/dojo/tests/_base/_loader/scope/scopeContainedXd.html new file mode 100644 index 0000000..c4c2eda --- /dev/null +++ b/includes/js/dojo/tests/_base/_loader/scope/scopeContainedXd.html @@ -0,0 +1,84 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <title>Multiversion Dojo: 0.4.3 and 1.0</title> + + <link rel="stylesheet" type="text/css" href="../../../../resources/dojo.css" /> + <link rel="stylesheet" type="text/css" href="../../../../../dijit/css/dijitTests.css" /> + <link rel="stylesheet" type="text/css" href="../../../../../dijit/themes/tundra/tundra.css" /> + + <script type="text/javascript"> + //djConfig for 0.4.3 setup. + djConfig = { + isDebug: true + }; + </script> + <script type="text/javascript" src="http://o.aolcdn.com/dojo/0.4.3/dojo.js"></script> + + <script type="text/javascript"> + //Scope map for this page is "burned in" via a build command (see HTML notes below). + //Also, just adding properties instead of redefining djConfig, since that + //will wipe out djConfig values set up by the 0.4.3 dojo. + djConfig.parseOnLoad = true; + djConfig.baseUrl = "../../../../"; + djConfig.useXDomain = true; //Technically this was set already in the 0.4.3 xd dojo.js file. + </script> + <script type="text/javascript" src="../../../../dojo.xd.js"></script> + <script type="text/javascript"> + dojo.require("dojo.widget.DropdownDatePicker"); + + //Get base xd path + var xdPath = location.href; + var lastIndex = location.href.lastIndexOf("/"); + xdPath = xdPath.substring(0, lastIndex + 1); + + //Set up xdomain locations for dojo/dijit/dojox. + jodo.registerModulePath("dojo", xdPath + "../../../../../dojo"); + jodo.registerModulePath("dijit", xdPath + "../../../../../dijit"); + jodo.registerModulePath("dojox", xdPath + "../../../../../dojox"); + + //Notice that dijit._Calendar is required, not jidit._Calendar. + //Same for the dojo resources (not jodo resources). + jodo.require("dijit._Calendar"); + jodo.require("dojo.date.locale"); + jodo.require("dojo.parser"); // scan page for widgets + + dojo.addOnLoad(function(){ + dojo.byId("output043").innerHTML = dojo.version.toString(); + }); + jodo.addOnLoad(function(){ + dojo.byId("output10").innerHTML = jodo.version.toString(); + }); + + function myHandler(id,newValue){ + console.debug("onChange for id = " + id + ", value: " + newValue); + } + </script> + </head> + <body> + <h1>XDomain Multiversion Dojo: 0.4.3 and 1.0</h1> + + <p><b>NOTE: This test only works with a built, xdomain version of Dojo, and it must be built with the scopeMap parameter (the backslashes below are required):</b></p> + + <p style="color: blue; background-color: yellow">build.sh profile=standard action=release scopeMap=[[\"dojo\",\"jodo\"],[\"dijit\",\"jidit\"],[\"dojox\",\"jodox\"]] xdDojoScopeName=jodo loader=xdomain</p> + + <p><b>Only load this page from an http:// URL</b>. Otherwise, the xd loading will not happen.</p> + + <p>This page xdomain loads Dojo 0.4.3 and Dojo 1.0 (under the jodo scope)</p> + + <p>Dojo 0.4.3 version: <span id="output043"></span></p> + + <p>Jodo version: <span id="output10"></span></p> + + <p> + <input dojoType="dropdowndatepicker" value="2006-10-31" containerToggle="wipe" containerToggleDuration="300" > + </p> + + <p class="tundra"> + <input id="calendar1" jodoType="dijit._Calendar" onChange="myHandler(this.id,arguments[0])"> + </p> + + </body> +</html> + diff --git a/includes/js/dojo/tests/_base/_loader/scope/scopeDjConfig.html b/includes/js/dojo/tests/_base/_loader/scope/scopeDjConfig.html new file mode 100644 index 0000000..0ef5daa --- /dev/null +++ b/includes/js/dojo/tests/_base/_loader/scope/scopeDjConfig.html @@ -0,0 +1,64 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <title>Multiversion Dojo: 0.4.3 and 1.0 (scoped djConfig)</title> + + <link rel="stylesheet" type="text/css" href="../../../../resources/dojo.css" /> + <link rel="stylesheet" type="text/css" href="../../../../../dijit/css/dijitTests.css" /> + <link rel="stylesheet" type="text/css" href="../../../../../dijit/themes/tundra/tundra.css" /> + + <script type="text/javascript"> + //djConfig for 0.4.3 setup. + djConfig = { + isDebug: true + }; + </script> + <script type="text/javascript" src="http://o.aolcdn.com/dojo/0.4.3/dojo.js"></script> + + <script type="text/javascript" src="../../../../dojo.js"></script> + <script type="text/javascript"> + dojo.require("dojo.widget.DropdownDatePicker"); + + //Notice that dijit._Calendar is required, not jidit._Calendar. + //Same for the dojo resources (not jodo resources). + jodo.require("dijit._Calendar"); + jodo.require("dojo.date.locale"); + jodo.require("dojo.parser"); // scan page for widgets + + dojo.addOnLoad(function(){ + dojo.byId("output043").innerHTML = djConfig.baseUrl; + }); + jodo.addOnLoad(function(){ + dojo.byId("output10").innerHTML = jodo.baseUrl; + }); + + function myHandler(id,newValue){ + console.debug("onChange for id = " + id + ", value: " + newValue); + } + </script> + </head> + <body> + <h1>Multiversion Dojo: 0.4.3 and 1.0 (scoped djConfig)</h1> + + <p><b>NOTE: This test only works with a built version of Dojo, and it must be built with the scopeDjConfig parameter (the backslashes below are required):</b></p> + + <p style="color: blue; background-color: yellow">build.sh profile=standard action=release scopeDjConfig=\{parseOnLoad:true,baseUrl:\"../../../../\",foo:\"bar\",scopeMap:[[\"dojo\",\"jodo\"],[\"dijit\",\"jidit\"],[\"dojox\",\"jodox\"]]\}</p> + + <p>This page loads Dojo 0.4.3 and Dojo 1.0 (under the jodo scope)</p> + + <p>djConfig.baseUrl should <b>not</b> exist: <span id="output043"></span></p> + + <p>jodo.baseUrl should be "../../../../": <span id="output10"></span></p> + + <p> + <input dojoType="dropdowndatepicker" value="2006-10-31" containerToggle="wipe" containerToggleDuration="300" > + </p> + + <p class="tundra"> + <input id="calendar1" jodoType="dijit._Calendar" onChange="myHandler(this.id,arguments[0])"> + </p> + + </body> +</html> + diff --git a/includes/js/dojo/tests/_base/_loader/scope/scopeSingle.html b/includes/js/dojo/tests/_base/_loader/scope/scopeSingle.html new file mode 100644 index 0000000..759fcbe --- /dev/null +++ b/includes/js/dojo/tests/_base/_loader/scope/scopeSingle.html @@ -0,0 +1,62 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <title>Using scope names inside dojo.require/dojoType</title> + + <link rel="stylesheet" type="text/css" href="../../../../resources/dojo.css" /> + <link rel="stylesheet" type="text/css" href="../../../../../dijit/css/dijitTests.css" /> + <link rel="stylesheet" type="text/css" href="../../../../../dijit/themes/tundra/tundra.css" /> + + <script type="text/javascript"> + //djConfig for 0.4.3 setup. + djConfig = { + isDebug: true, + parseOnLoad: true, + baseUrl: "../../../../", + scopeMap: [ + ["dojo", "jodo"], + ["dijit", "jidit"], + ["dojox", "jodox"] + ] + }; + </script> + + <script type="text/javascript" src="../../../../dojo.js"></script> + <script type="text/javascript"> + + //Notice that dijit._Calendar is required, not jidit._Calendar. + //Same for the dojo resources (not jodo resources). + jodo.require("dijit._Calendar"); + jodo.require("dojo.date.locale"); + jodo.require("dojo.parser"); // scan page for widgets + + jodo.addOnLoad(function(){ + jodo.byId("output10").innerHTML = jodo.version.toString(); + }); + + function myHandler(id,newValue){ + console.debug("onChange for id = " + id + ", value: " + newValue); + } + function foobar(){ + jodo.byId("typeOut").innerHTML = "typeof dojo: " + (typeof dojo) + "<br>typeof dijit: " + (typeof dijit) + "<br>typeof dojox: " + (typeof dojox); + } + setTimeout(foobar, 2000); + </script> + </head> + <body> + <h1>Using scope names inside dojo.require/dojoType</h1> + + <p><b>NOTE: This test only works with a built version of Dojo.</b></p> + + <p>Jodo version: <span id="output10"></span></p> + + <p><b>typeof dojo, dijit and dojox should be undefined</b>: <br><span id="typeOut"></span></p> + + <p class="tundra"> + <input id="calendar1" jodoType="jidit._Calendar" onChange="myHandler(this.id,arguments[0])"> + </p> + + </body> +</html> + diff --git a/includes/js/dojo/tests/_base/_loader/scope/scopeSingleDaac.html b/includes/js/dojo/tests/_base/_loader/scope/scopeSingleDaac.html new file mode 100644 index 0000000..8f9d7d8 --- /dev/null +++ b/includes/js/dojo/tests/_base/_loader/scope/scopeSingleDaac.html @@ -0,0 +1,63 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <title>Using scope names inside dojo.require/dojoType</title> + + <link rel="stylesheet" type="text/css" href="../../../../resources/dojo.css" /> + <link rel="stylesheet" type="text/css" href="../../../../../dijit/css/dijitTests.css" /> + <link rel="stylesheet" type="text/css" href="../../../../../dijit/themes/tundra/tundra.css" /> + + <script type="text/javascript"> + //djConfig for 0.4.3 setup. + djConfig = { + isDebug: true, + debugAtAllCosts: true, + parseOnLoad: true, + baseUrl: "../../../../", + scopeMap: [ + ["dojo", "jodo"], + ["dijit", "jidit"], + ["dojox", "jodox"] + ] + }; + </script> + + <script type="text/javascript" src="../../../../dojo.js"></script> + <script type="text/javascript"> + + //Notice that dijit._Calendar is required, not jidit._Calendar. + //Same for the dojo resources (not jodo resources). + jodo.require("dijit._Calendar"); + jodo.require("dojo.date.locale"); + jodo.require("dojo.parser"); // scan page for widgets + + jodo.addOnLoad(function(){ + jodo.byId("output10").innerHTML = jodo.version.toString(); + }); + + function myHandler(id,newValue){ + console.debug("onChange for id = " + id + ", value: " + newValue); + } + function foobar(){ + jodo.byId("typeOut").innerHTML = "typeof dojo: " + (typeof dojo) + "<br>typeof dijit: " + (typeof dijit) + "<br>typeof dojox: " + (typeof dojox); + } + setTimeout(foobar, 2000); + </script> + </head> + <body> + <h1>Using scope names inside dojo.require/dojoType</h1> + + <p><b>NOTE: This test only works with a built version of Dojo.</b></p> + + <p>Jodo version: <span id="output10"></span></p> + + <p><b>typeof dojo, dijit and dojox should be object, since debugAtAllCosts is ON</b>: <br><span id="typeOut"></span></p> + + <p class="tundra"> + <input id="calendar1" jodoType="jidit._Calendar" onChange="myHandler(this.id,arguments[0])"> + </p> + + </body> +</html> + |