From e44a7e37b6c7b5961adaffc62b9042b8d442938e Mon Sep 17 00:00:00 2001 From: mensonge Date: Thu, 13 Nov 2008 09:49:11 +0000 Subject: 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 --- .../js/dojo/tests/_base/_loader/addLoadEvents.html | 37 ++++++++++ .../js/dojo/tests/_base/_loader/afterOnLoad.html | 56 ++++++++++++++ includes/js/dojo/tests/_base/_loader/bootstrap.js | 86 ++++++++++++++++++++++ includes/js/dojo/tests/_base/_loader/getText.txt | 1 + .../js/dojo/tests/_base/_loader/hostenv_browser.js | 15 ++++ .../js/dojo/tests/_base/_loader/hostenv_rhino.js | 17 +++++ .../tests/_base/_loader/hostenv_spidermonkey.js | 15 ++++ includes/js/dojo/tests/_base/_loader/loader.js | 52 +++++++++++++ .../js/dojo/tests/_base/_loader/scope/scope04.html | 80 ++++++++++++++++++++ .../tests/_base/_loader/scope/scopeContained.html | 71 ++++++++++++++++++ .../_base/_loader/scope/scopeContainedXd.html | 84 +++++++++++++++++++++ .../tests/_base/_loader/scope/scopeDjConfig.html | 64 ++++++++++++++++ .../tests/_base/_loader/scope/scopeSingle.html | 62 ++++++++++++++++ .../tests/_base/_loader/scope/scopeSingleDaac.html | 63 ++++++++++++++++ 14 files changed, 703 insertions(+) create mode 100644 includes/js/dojo/tests/_base/_loader/addLoadEvents.html create mode 100644 includes/js/dojo/tests/_base/_loader/afterOnLoad.html create mode 100644 includes/js/dojo/tests/_base/_loader/bootstrap.js create mode 100644 includes/js/dojo/tests/_base/_loader/getText.txt create mode 100644 includes/js/dojo/tests/_base/_loader/hostenv_browser.js create mode 100644 includes/js/dojo/tests/_base/_loader/hostenv_rhino.js create mode 100644 includes/js/dojo/tests/_base/_loader/hostenv_spidermonkey.js create mode 100644 includes/js/dojo/tests/_base/_loader/loader.js create mode 100644 includes/js/dojo/tests/_base/_loader/scope/scope04.html create mode 100644 includes/js/dojo/tests/_base/_loader/scope/scopeContained.html create mode 100644 includes/js/dojo/tests/_base/_loader/scope/scopeContainedXd.html create mode 100644 includes/js/dojo/tests/_base/_loader/scope/scopeDjConfig.html create mode 100644 includes/js/dojo/tests/_base/_loader/scope/scopeSingle.html create mode 100644 includes/js/dojo/tests/_base/_loader/scope/scopeSingleDaac.html (limited to 'includes/js/dojo/tests/_base/_loader') 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 @@ + + + + Testing dojo.addOnLoad() and dojo.addOnUnload() + + + + +

Testing dojo.addOnLoad() and dojo.addOnUnload()

+ +

This page has registers a function with dojo.addOnLoad() and dojo.addOnUnload.

+ +

dojo.addOnLoad(): You should see an alert with the page first loads ("addOnLoad works").

+ +

dojo.addOnUnload(): You should see an alert if the page is reloaded, or if you navigate to a + different web page ("addOnUnload works"). + + + 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 @@ + + + + Testing afterOnLoad + + + + + + + + +

Testing afterOnLoad

+ +

This page only works with a dojo build. It will not work properly if you run it directly from the subversion source.

+ +

This page tests loading dojo after the page is loaded.

+ +

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.

+ +

+ +

+ + 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 @@ + + + + Multiversion Dojo: 0.4.3 and 1.0 + + + + + + + + + + + + + +

Multiversion Dojo: 0.4.3 and 1.0

+ +

NOTE: This test only works with a built version of Dojo

+ +

This page loads Dojo 0.4.3 and Dojo 1.0.

+ +

Dojo 0.4.3 version:

+ +

Dojo 1.0 version:

+ +

dojo.addClass should be undefined:

+ +

+ +

+ +

+ +

+ + + + 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 @@ + + + + Multiversion Dojo: 0.4.3 and 1.0 + + + + + + + + + + + + + +

Multiversion Dojo: 0.4.3 and 1.0

+ +

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):

+ +

build.sh profile=standard action=release scopeMap=[[\"dojo\",\"jodo\"],[\"dijit\",\"jidit\"],[\"dojox\",\"jodox\"]]

+ +

This page loads Dojo 0.4.3 and Dojo 1.0 (under the jodo scope)

+ +

Dojo 0.4.3 version:

+ +

Jodo version:

+ +

+ +

+ +

+ +

+ + + + 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 @@ + + + + Multiversion Dojo: 0.4.3 and 1.0 + + + + + + + + + + + + + +

XDomain Multiversion Dojo: 0.4.3 and 1.0

+ +

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):

+ +

build.sh profile=standard action=release scopeMap=[[\"dojo\",\"jodo\"],[\"dijit\",\"jidit\"],[\"dojox\",\"jodox\"]] xdDojoScopeName=jodo loader=xdomain

+ +

Only load this page from an http:// URL. Otherwise, the xd loading will not happen.

+ +

This page xdomain loads Dojo 0.4.3 and Dojo 1.0 (under the jodo scope)

+ +

Dojo 0.4.3 version:

+ +

Jodo version:

+ +

+ +

+ +

+ +

+ + + + 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 @@ + + + + Multiversion Dojo: 0.4.3 and 1.0 (scoped djConfig) + + + + + + + + + + + + +

Multiversion Dojo: 0.4.3 and 1.0 (scoped djConfig)

+ +

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):

+ +

build.sh profile=standard action=release scopeDjConfig=\{parseOnLoad:true,baseUrl:\"../../../../\",foo:\"bar\",scopeMap:[[\"dojo\",\"jodo\"],[\"dijit\",\"jidit\"],[\"dojox\",\"jodox\"]]\}

+ +

This page loads Dojo 0.4.3 and Dojo 1.0 (under the jodo scope)

+ +

djConfig.baseUrl should not exist:

+ +

jodo.baseUrl should be "../../../../":

+ +

+ +

+ +

+ +

+ + + + 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 @@ + + + + Using scope names inside dojo.require/dojoType + + + + + + + + + + + +

Using scope names inside dojo.require/dojoType

+ +

NOTE: This test only works with a built version of Dojo.

+ +

Jodo version:

+ +

typeof dojo, dijit and dojox should be undefined:

+ +

+ +

+ + + + 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 @@ + + + + Using scope names inside dojo.require/dojoType + + + + + + + + + + + +

Using scope names inside dojo.require/dojoType

+ +

NOTE: This test only works with a built version of Dojo.

+ +

Jodo version:

+ +

typeof dojo, dijit and dojox should be object, since debugAtAllCosts is ON:

+ +

+ +

+ + + + -- cgit v1.2.3