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 --- includes/js/dojo/tests/_base/Color.js | 32 ++ includes/js/dojo/tests/_base/Deferred.js | 76 +++ includes/js/dojo/tests/_base/NodeList.html | 370 ++++++++++++++ .../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 +++ includes/js/dojo/tests/_base/array.js | 301 +++++++++++ includes/js/dojo/tests/_base/connect.js | 225 +++++++++ includes/js/dojo/tests/_base/declare.js | 197 ++++++++ includes/js/dojo/tests/_base/fx.html | 342 +++++++++++++ includes/js/dojo/tests/_base/fx.js | 8 + includes/js/dojo/tests/_base/fx_delay.html | 22 + includes/js/dojo/tests/_base/html.html | 556 +++++++++++++++++++++ includes/js/dojo/tests/_base/html.js | 12 + includes/js/dojo/tests/_base/html_box.html | 207 ++++++++ includes/js/dojo/tests/_base/html_box_quirks.html | 205 ++++++++ includes/js/dojo/tests/_base/html_quirks.html | 322 ++++++++++++ includes/js/dojo/tests/_base/html_rtl.html | 110 ++++ includes/js/dojo/tests/_base/json.js | 37 ++ includes/js/dojo/tests/_base/lang.js | 180 +++++++ includes/js/dojo/tests/_base/query.html | 154 ++++++ includes/js/dojo/tests/_base/query.js | 9 + includes/js/dojo/tests/_base/timeout.php | 7 + includes/js/dojo/tests/_base/xhr.html | 404 +++++++++++++++ includes/js/dojo/tests/_base/xhr.js | 8 + includes/js/dojo/tests/_base/xhrDummyMethod.php | 7 + 37 files changed, 4494 insertions(+) create mode 100644 includes/js/dojo/tests/_base/Color.js create mode 100644 includes/js/dojo/tests/_base/Deferred.js create mode 100644 includes/js/dojo/tests/_base/NodeList.html 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 create mode 100644 includes/js/dojo/tests/_base/array.js create mode 100644 includes/js/dojo/tests/_base/connect.js create mode 100644 includes/js/dojo/tests/_base/declare.js create mode 100644 includes/js/dojo/tests/_base/fx.html create mode 100644 includes/js/dojo/tests/_base/fx.js create mode 100644 includes/js/dojo/tests/_base/fx_delay.html create mode 100644 includes/js/dojo/tests/_base/html.html create mode 100644 includes/js/dojo/tests/_base/html.js create mode 100644 includes/js/dojo/tests/_base/html_box.html create mode 100644 includes/js/dojo/tests/_base/html_box_quirks.html create mode 100644 includes/js/dojo/tests/_base/html_quirks.html create mode 100644 includes/js/dojo/tests/_base/html_rtl.html create mode 100644 includes/js/dojo/tests/_base/json.js create mode 100644 includes/js/dojo/tests/_base/lang.js create mode 100644 includes/js/dojo/tests/_base/query.html create mode 100644 includes/js/dojo/tests/_base/query.js create mode 100644 includes/js/dojo/tests/_base/timeout.php create mode 100644 includes/js/dojo/tests/_base/xhr.html create mode 100644 includes/js/dojo/tests/_base/xhr.js create mode 100644 includes/js/dojo/tests/_base/xhrDummyMethod.php (limited to 'includes/js/dojo/tests/_base') diff --git a/includes/js/dojo/tests/_base/Color.js b/includes/js/dojo/tests/_base/Color.js new file mode 100644 index 0000000..fa09842 --- /dev/null +++ b/includes/js/dojo/tests/_base/Color.js @@ -0,0 +1,32 @@ +if(!dojo._hasResource["tests._base.Color"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests._base.Color"] = true; +dojo.provide("tests._base.Color"); + +(function(){ + var white = dojo.colorFromString("white").toRgba(); + var maroon = dojo.colorFromString("maroon").toRgba(); + var verifyColor = function(t, source, expected){ + var color = new dojo.Color(source); + t.is(expected, color.toRgba()); + dojo.forEach(color.toRgba(), function(n){ t.is("number", typeof(n)); }); + } + + doh.register("tests._base.Color", + [ + function testColor1(t){ verifyColor(t, "maroon", maroon); }, + function testColor2(t){ verifyColor(t, "white", white); }, + function testColor3(t){ verifyColor(t, "#fff", white); }, + function testColor4(t){ verifyColor(t, "#ffffff", white); }, + function testColor5(t){ verifyColor(t, "rgb(255,255,255)", white); }, + function testColor6(t){ verifyColor(t, "#800000", maroon); }, + function testColor7(t){ verifyColor(t, "rgb(128, 0, 0)", maroon); }, + function testColor8(t){ verifyColor(t, "rgba(128, 0, 0, 0.5)", [128, 0, 0, 0.5]); }, + function testColor9(t){ verifyColor(t, maroon, maroon); }, + function testColor10(t){ verifyColor(t, [1, 2, 3], [1, 2, 3, 1]); }, + function testColor11(t){ verifyColor(t, [1, 2, 3, 0.5], [1, 2, 3, 0.5]); }, + function testColor12(t){ verifyColor(t, dojo.blendColors(new dojo.Color("black"), new dojo.Color("white"), 0.5), [128, 128, 128, 1]); } + ] + ); +})(); + +} diff --git a/includes/js/dojo/tests/_base/Deferred.js b/includes/js/dojo/tests/_base/Deferred.js new file mode 100644 index 0000000..5dcf003 --- /dev/null +++ b/includes/js/dojo/tests/_base/Deferred.js @@ -0,0 +1,76 @@ +if(!dojo._hasResource["tests._base.Deferred"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests._base.Deferred"] = true; +dojo.provide("tests._base.Deferred"); + +doh.register("tests._base.Deferred", + [ + + function callback(t){ + var nd = new dojo.Deferred(); + var cnt = 0; + nd.addCallback(function(res){ + doh.debug("debug from dojo.Deferred callback"); + return res; + }); + nd.addCallback(function(res){ + // t.debug("val:", res); + cnt+=res; + return cnt; + }); + nd.callback(5); + // t.debug("cnt:", cnt); + t.assertEqual(cnt, 5); + }, + + function callback_extra_args(t){ + var nd = new dojo.Deferred(); + var cnt = 0; + nd.addCallback(dojo.global, function(base, res){ cnt+=base; cnt+=res; return cnt; }, 30); + nd.callback(5); + t.assertEqual(cnt, 35); + }, + + function errback(t){ + var nd = new dojo.Deferred(); + var cnt = 0; + nd.addErrback(function(val){ + return ++cnt; + }); + nd.errback(); + t.assertEqual(cnt, 1); + }, + + function callbackTwice(t){ + var nd = new dojo.Deferred(); + var cnt = 0; + nd.addCallback(function(res){ + return ++cnt; + }); + nd.callback(); + t.assertEqual(cnt, 1); + var thrown = false; + try{ + nd.callback(); + }catch(e){ + thrown = true; + } + t.assertTrue(thrown); + }, + + function addBoth(t){ + var nd = new dojo.Deferred(); + var cnt = 0; + nd.addBoth(function(res){ + return ++cnt; + }); + nd.callback(); + t.assertEqual(cnt, 1); + + // nd.callback(); + // t.debug(cnt); + // t.assertEqual(cnt, 1); + } + ] +); + +} diff --git a/includes/js/dojo/tests/_base/NodeList.html b/includes/js/dojo/tests/_base/NodeList.html new file mode 100644 index 0000000..e3f08c5 --- /dev/null +++ b/includes/js/dojo/tests/_base/NodeList.html @@ -0,0 +1,370 @@ + + + + + + testing dojo.NodeList + + + + +

testing dojo.NodeList

+
+ 100px square, abs +
+
+ c1 +
+ + + 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:

+ +

+ +

+ + + + diff --git a/includes/js/dojo/tests/_base/array.js b/includes/js/dojo/tests/_base/array.js new file mode 100644 index 0000000..6611257 --- /dev/null +++ b/includes/js/dojo/tests/_base/array.js @@ -0,0 +1,301 @@ +if(!dojo._hasResource["tests._base.array"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests._base.array"] = true; +dojo.provide("tests._base.array"); + +tests.register("tests._base.array", + [ + function testIndexOf(t){ + var foo = [128, 256, 512]; + var bar = ["aaa", "bbb", "ccc"]; + + t.assertEqual(1, dojo.indexOf([45, 56, 85], 56)); + t.assertEqual(1, dojo.indexOf([Number, String, Date], String)); + t.assertEqual(1, dojo.indexOf(foo, foo[1])); + t.assertEqual(2, dojo.indexOf(foo, foo[2])); + t.assertEqual(1, dojo.indexOf(bar, bar[1])); + t.assertEqual(2, dojo.indexOf(bar, bar[2])); + t.assertEqual(-1, dojo.indexOf({a:1}, "a")); + + foo.push(bar); + t.assertEqual(3, dojo.indexOf(foo, bar)); + }, + + function testIndexOfFromIndex(t){ + var foo = [128, 256, 512]; + var bar = ["aaa", "bbb", "ccc"]; + + t.assertEqual(-1, dojo.indexOf([45, 56, 85], 56, 2)); + t.assertEqual(1, dojo.indexOf([45, 56, 85], 56, 1)); + t.assertEqual(1, dojo.indexOf([45, 56, 85], 56, -1)); + // Make sure going out of bounds doesn't throw us in an infinite loop + t.assertEqual(-1, dojo.indexOf([45, 56, 85], 56, 3)); + }, + + function testLastIndexOf(t){ + var foo = [128, 256, 512]; + var bar = ["aaa", "bbb", "aaa", "ccc"]; + + t.assertEqual(1, dojo.indexOf([45, 56, 85], 56)); + t.assertEqual(1, dojo.indexOf([Number, String, Date], String)); + t.assertEqual(1, dojo.lastIndexOf(foo, foo[1])); + t.assertEqual(2, dojo.lastIndexOf(foo, foo[2])); + t.assertEqual(1, dojo.lastIndexOf(bar, bar[1])); + t.assertEqual(2, dojo.lastIndexOf(bar, bar[2])); + t.assertEqual(2, dojo.lastIndexOf(bar, bar[0])); + }, + + function testLastIndexOfFromIndex(t){ + t.assertEqual(1, dojo.lastIndexOf([45, 56, 85], 56, 1)); + t.assertEqual(-1, dojo.lastIndexOf([45, 56, 85], 85, 1)); + t.assertEqual(-1, dojo.lastIndexOf([45, 56, 85], 85, -1)); + t.assertEqual(0, dojo.lastIndexOf([45, 56, 45], 45, 0)); + }, + + function testForEach(t){ + var foo = [128, "bbb", 512]; + dojo.forEach(foo, function(elt, idx, array){ + switch(idx){ + case 0: t.assertEqual(128, elt); break; + case 1: t.assertEqual("bbb", elt); break; + case 2: t.assertEqual(512, elt); break; + default: t.assertTrue(false); + } + }); + + var noException = true; + try{ + dojo.forEach(undefined, function(){}); + }catch(e){ + noException = false; + } + t.assertTrue(noException); + }, + + function testForEach_str(t){ + var bar = 'abc'; + dojo.forEach(bar, function(elt, idx, array){ + switch(idx){ + case 0: t.assertEqual("a", elt); break; + case 1: t.assertEqual("b", elt); break; + case 2: t.assertEqual("c", elt); break; + default: t.assertTrue(false); + } + }); + }, + // FIXME: test forEach w/ a NodeList()? + + function testForEach_string_callback(t){ + // Test using strings as callback", which accept the parameters with + // the names "item", "index" and "array"! + var foo = [128, "bbb", 512]; + // Test that the variable "item" contains the value of each item. + this._res = ""; + dojo.forEach(foo, 'this._res+=item', this); + t.assertEqual(this._res, "128bbb512"); + // Test that the variable "index" contains each index. + this._res = []; + dojo.forEach(foo, 'this._res.push(index)', this); + t.assertEqual(this._res, [0,1,2]); + // Test that the variable "array" always contains the entire array. + this._res = []; + dojo.forEach(foo, 'this._res.push(array)', this); + t.assertEqual(this._res, [[128, "bbb", 512],[128, "bbb", 512],[128, "bbb", 512]]); + // Catch undefined variable usage (I used to use "i" :-)). + var caughtException = false; + try{ + dojo.forEach(foo, 'this._res+=i', this); + }catch(e){ + caughtException = true; + } + t.assertTrue(caughtException); + }, + + // FIXME: test forEach w/ a NodeList()? + function testEvery(t){ + var foo = [128, "bbb", 512]; + + t.assertTrue( + dojo.every(foo, function(elt, idx, array){ + t.assertEqual(Array, array.constructor); + t.assertTrue(dojo.isArray(array)); + t.assertTrue(typeof idx == "number"); + if(idx == 1){ t.assertEqual("bbb" , elt); } + return true; + }) + ); + + t.assertTrue( + dojo.every(foo, function(elt, idx, array){ + switch(idx){ + case 0: t.assertEqual(128, elt); return true; + case 1: t.assertEqual("bbb", elt); return true; + case 2: t.assertEqual(512, elt); return true; + default: return false; + } + }) + ); + + t.assertFalse( + dojo.every(foo, function(elt, idx, array){ + switch(idx){ + case 0: t.assertEqual(128, elt); return true; + case 1: t.assertEqual("bbb", elt); return true; + case 2: t.assertEqual(512, elt); return false; + default: return true; + } + }) + ); + + }, + + function testEvery_str(t){ + var bar = 'abc'; + t.assertTrue( + dojo.every(bar, function(elt, idx, array){ + switch(idx){ + case 0: t.assertEqual("a", elt); return true; + case 1: t.assertEqual("b", elt); return true; + case 2: t.assertEqual("c", elt); return true; + default: return false; + } + }) + ); + + t.assertFalse( + dojo.every(bar, function(elt, idx, array){ + switch(idx){ + case 0: t.assertEqual("a", elt); return true; + case 1: t.assertEqual("b", elt); return true; + case 2: t.assertEqual("c", elt); return false; + default: return true; + } + }) + ); + }, + // FIXME: test NodeList for every()? + + function testSome(t){ + var foo = [128, "bbb", 512]; + t.assertTrue( + dojo.some(foo, function(elt, idx, array){ + t.assertEqual(3, array.length); + return true; + }) + ); + + t.assertTrue( + dojo.some(foo, function(elt, idx, array){ + if(idx < 1){ return true; } + return false; + }) + ); + + t.assertFalse( + dojo.some(foo, function(elt, idx, array){ + return false; + }) + ); + + t.assertTrue( + dojo.some(foo, function(elt, idx, array){ + t.assertEqual(Array, array.constructor); + t.assertTrue(dojo.isArray(array)); + t.assertTrue(typeof idx == "number"); + if(idx == 1){ t.assertEqual("bbb" , elt); } + return true; + }) + ); + }, + + function testSome_str(t){ + var bar = 'abc'; + t.assertTrue( + dojo.some(bar, function(elt, idx, array){ + t.assertEqual(3, array.length); + switch(idx){ + case 0: t.assertEqual("a", elt); return true; + case 1: t.assertEqual("b", elt); return true; + case 2: t.assertEqual("c", elt); return true; + default: return false; + } + }) + ); + + t.assertTrue( + dojo.some(bar, function(elt, idx, array){ + switch(idx){ + case 0: t.assertEqual("a", elt); return true; + case 1: t.assertEqual("b", elt); return true; + case 2: t.assertEqual("c", elt); return false; + default: return true; + } + }) + ); + + t.assertFalse( + dojo.some(bar, function(elt, idx, array){ + return false; + }) + ); + }, + // FIXME: need to add scoping tests for all of these!!! + + function testFilter(t){ + var foo = ["foo", "bar", 10]; + + t.assertEqual(["foo"], + dojo.filter(foo, function(elt, idx, array){ + return idx < 1; + }) + ); + + t.assertEqual(["foo"], + dojo.filter(foo, function(elt, idx, array){ + return elt == "foo"; + }) + ); + + t.assertEqual([], + dojo.filter(foo, function(elt, idx, array){ + return false; + }) + ); + + t.assertEqual([10], + dojo.filter(foo, function(elt, idx, array){ + return typeof elt == "number"; + }) + ); + }, + + function testFilter_str(t){ + var foo = "thinger blah blah blah"; + t.assertEqual(["t", "h", "i"], + dojo.filter(foo, function(elt, idx, array){ + return idx < 3; + }) + ); + + t.assertEqual([], + dojo.filter(foo, function(elt, idx, array){ + return false; + }) + ); + }, + + function testMap(t){ + t.assertEqual([], + dojo.map([], function(){ return true; }) + ); + + t.assertEqual([1, 2, 3], + dojo.map(["cat", "dog", "mouse"], function(elt, idx, array){ + return idx+1; + }) + ); + } + ] +); + + +} diff --git a/includes/js/dojo/tests/_base/connect.js b/includes/js/dojo/tests/_base/connect.js new file mode 100644 index 0000000..3761861 --- /dev/null +++ b/includes/js/dojo/tests/_base/connect.js @@ -0,0 +1,225 @@ +if(!dojo._hasResource["tests._base.connect"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests._base.connect"] = true; +dojo.provide("tests._base.connect"); + +hub = function(){ +} + +failures = 0; +bad = function(){ + failures++; +} + +good = function(){ +} + +// make 'iterations' connections to hub +// roughly half of which will be to 'good' and +// half to 'bad' +// all connections to 'bad' are disconnected +// test can then be performed on the values +// 'failures' and 'successes' +markAndSweepTest = function(iterations){ + var marked = []; + // connections + for(var i=0; i + + testing Core FX + + + + + + + +

testing Core FX

+
+ + +
+
+

+ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean + semper sagittis velit. Cras in mi. Duis porta mauris ut ligula. + Proin porta rutrum lacus. Etiam consequat scelerisque quam. Nulla + facilisi. Maecenas luctus venenatis nulla. In sit amet dui non mi + semper iaculis. Sed molestie tortor at ipsum. Morbi dictum rutrum + magna. Sed vitae risus. +

+

+ Aliquam vitae enim. Duis scelerisque metus auctor est venenatis + imperdiet. Fusce dignissim porta augue. Nulla vestibulum. Integer + lorem nunc, ullamcorper a, commodo ac, malesuada sed, dolor. Aenean + id mi in massa bibendum suscipit. Integer eros. Nullam suscipit + mauris. In pellentesque. Mauris ipsum est, pharetra semper, + pharetra in, viverra quis, tellus. Etiam purus. Quisque egestas, + tortor ac cursus lacinia, felis leo adipiscing nisi, et rhoncus + elit dolor eget eros. Fusce ut quam. Suspendisse eleifend leo vitae + ligula. Nulla facilisi. Nulla rutrum, erat vitae lacinia dictum, + pede purus imperdiet lacus, ut semper velit ante id metus. Praesent + massa dolor, porttitor sed, pulvinar in, consequat ut, leo. Nullam + nec est. Aenean id risus blandit tortor pharetra congue. + Suspendisse pulvinar. +

+
+ + + + + + diff --git a/includes/js/dojo/tests/_base/fx.js b/includes/js/dojo/tests/_base/fx.js new file mode 100644 index 0000000..acb1ca3 --- /dev/null +++ b/includes/js/dojo/tests/_base/fx.js @@ -0,0 +1,8 @@ +if(!dojo._hasResource["tests._base.fx"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests._base.fx"] = true; +dojo.provide("tests._base.fx"); +if(dojo.isBrowser){ + doh.registerUrl("tests._base.fx", dojo.moduleUrl("tests", "_base/fx.html"), 15000); +} + +} diff --git a/includes/js/dojo/tests/_base/fx_delay.html b/includes/js/dojo/tests/_base/fx_delay.html new file mode 100644 index 0000000..c2a1cd9 --- /dev/null +++ b/includes/js/dojo/tests/_base/fx_delay.html @@ -0,0 +1,22 @@ + + + + + + + +
+ + diff --git a/includes/js/dojo/tests/_base/html.html b/includes/js/dojo/tests/_base/html.html new file mode 100644 index 0000000..912c8a6 --- /dev/null +++ b/includes/js/dojo/tests/_base/html.html @@ -0,0 +1,556 @@ + + + + + testing Core HTML/DOM/CSS/Style utils + + + + + + +

testing Core HTML/DOM/CSS/Style utils

+
+ 100px square, abs +
+
+ 100px square, abs, 10px margin +
+
+ 100px square, abs, 10px margin, 10px padding +
+
+ 100px square, abs, 10px padding +
+
+ 100px square, abs, 10px left and top padding +
+
+ 100px square, abs, 10px left and top padding, 10px bottom and right margin +
+
+ 100px square, abs, 10px yellow border +
+
+ 100px square, abs, 10px yellow border, 10px margin +
+
+ 100px square, abs, 10px yellow border, 10px margin, 10px padding +
+
+ 100px square, no positioning +
+ + +
+
+
+
+ +
+ + + + + + +
+ + + diff --git a/includes/js/dojo/tests/_base/html.js b/includes/js/dojo/tests/_base/html.js new file mode 100644 index 0000000..99fe80b --- /dev/null +++ b/includes/js/dojo/tests/_base/html.js @@ -0,0 +1,12 @@ +if(!dojo._hasResource["tests._base.html"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests._base.html"] = true; +dojo.provide("tests._base.html"); +if(dojo.isBrowser){ + doh.registerUrl("tests._base.html", dojo.moduleUrl("tests", "_base/html.html"), 15000); + doh.registerUrl("tests._base.html_rtl", dojo.moduleUrl("tests", "_base/html_rtl.html"), 15000); + doh.registerUrl("tests._base.html_quirks", dojo.moduleUrl("tests", "_base/html_quirks.html"), 15000); + doh.registerUrl("tests._base.html_box", dojo.moduleUrl("tests", "_base/html_box.html"), 35000); + doh.registerUrl("tests._base.html_box_quirks", dojo.moduleUrl("tests", "_base/html_box_quirks.html"), 35000); +} + +} diff --git a/includes/js/dojo/tests/_base/html_box.html b/includes/js/dojo/tests/_base/html_box.html new file mode 100644 index 0000000..fd7ec53 --- /dev/null +++ b/includes/js/dojo/tests/_base/html_box.html @@ -0,0 +1,207 @@ + + + + + test html.js Box utils + + + + + + + + + diff --git a/includes/js/dojo/tests/_base/html_box_quirks.html b/includes/js/dojo/tests/_base/html_box_quirks.html new file mode 100644 index 0000000..f87ca44 --- /dev/null +++ b/includes/js/dojo/tests/_base/html_box_quirks.html @@ -0,0 +1,205 @@ + + + + test html.js Box utils + + + + + + + + + diff --git a/includes/js/dojo/tests/_base/html_quirks.html b/includes/js/dojo/tests/_base/html_quirks.html new file mode 100644 index 0000000..ddc7825 --- /dev/null +++ b/includes/js/dojo/tests/_base/html_quirks.html @@ -0,0 +1,322 @@ + + + + testing Core HTML/DOM/CSS/Style utils in quirks mode + + + + + + +

testing Core HTML/DOM/CSS/Style utils

+
+ 100px square, abs +
+
+ 100px square, abs, 10px margin +
+
+ 100px square, abs, 10px margin, 10px padding +
+
+ 100px square, abs, 10px padding +
+
+ 100px square, abs, 10px left and top padding +
+
+ 100px square, abs, 10px left and top padding, 10px bottom and right margin +
+
+ 100px square, abs, 10px yellow border +
+
+ 100px square, abs, 10px yellow border, 10px margin +
+
+ 100px square, abs, 10px yellow border, 10px margin, 10px padding +
+
+ 100px square, no positioning +
+ + + diff --git a/includes/js/dojo/tests/_base/html_rtl.html b/includes/js/dojo/tests/_base/html_rtl.html new file mode 100644 index 0000000..8d74afa --- /dev/null +++ b/includes/js/dojo/tests/_base/html_rtl.html @@ -0,0 +1,110 @@ + + + + testing Core HTML/DOM/CSS/Style utils + + + + + + +

testing Core HTML/DOM/CSS/Style utils

+
+ 100px rect, abs, + mouse point is at top-left after the test "eventClientXY" +
+ + + + + diff --git a/includes/js/dojo/tests/_base/json.js b/includes/js/dojo/tests/_base/json.js new file mode 100644 index 0000000..3a9a24c --- /dev/null +++ b/includes/js/dojo/tests/_base/json.js @@ -0,0 +1,37 @@ +if(!dojo._hasResource["tests._base.json"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests._base.json"] = true; +dojo.provide("tests._base.json"); + +tests.register("tests._base.json", + [ + //Not testing dojo.toJson() on its own since Rhino will output the object properties in a different order. + //Still valid json, but just in a different order than the source string. + + // take a json-compatible object, convert it to a json string, then put it back into json. + function toAndFromJson(t){ + var testObj = {a:"a", b:1, c:"c", d:"d", e:{e1:"e1", e2:2}, f:[1,2,3], g:"g",h:{h1:{h2:{h3:"h3"}}}}; + + var mirrorObj = dojo.fromJson(dojo.toJson(testObj)); + t.assertEqual("a", mirrorObj.a); + t.assertEqual(1, mirrorObj.b); + t.assertEqual("c", mirrorObj.c); + t.assertEqual("d", mirrorObj.d); + t.assertEqual("e1", mirrorObj.e.e1); + t.assertEqual(2, mirrorObj.e.e2); + t.assertEqual(1, mirrorObj.f[0]); + t.assertEqual(2, mirrorObj.f[1]); + t.assertEqual(3, mirrorObj.f[2]); + t.assertEqual("g", mirrorObj.g); + t.assertEqual("h3", mirrorObj.h.h1.h2.h3); + var badJson; + try{ + badJson = dojo.fromJson("bad json"); // this should throw an exception, and not set badJson + }catch(e){ + } + t.assertEqual(undefined,badJson); + } + ] +); + + +} diff --git a/includes/js/dojo/tests/_base/lang.js b/includes/js/dojo/tests/_base/lang.js new file mode 100644 index 0000000..38acbff --- /dev/null +++ b/includes/js/dojo/tests/_base/lang.js @@ -0,0 +1,180 @@ +if(!dojo._hasResource["tests._base.lang"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests._base.lang"] = true; +dojo.provide("tests._base.lang"); + +tests.register("tests._base.lang", + [ + function mixin(t){ + var src = { + foo: function(){ + t.debug("foo"); + }, + bar: "bar" + }; + var dest = {}; + dojo.mixin(dest, src); + t.assertEqual("function", typeof dest["foo"]); + t.assertEqual("string", typeof dest["bar"]); + }, + + function extend(t){ + var src = { + foo: function(){ + t.debug("foo"); + }, + bar: "bar" + }; + function dest(){} + dojo.extend(dest, src); + var test = new dest(); + t.assertEqual("function", typeof test["foo"]); + t.assertEqual("string", typeof test["bar"]); + }, + + function isObject(t){ + t.assertFalse(dojo.isObject(true)); + t.assertFalse(dojo.isObject(false)); + t.assertFalse(dojo.isObject("foo")); + t.assertTrue(dojo.isObject(new String("foo"))); + t.assertTrue(dojo.isObject(null)); + t.assertTrue(dojo.isObject({})); + t.assertTrue(dojo.isObject([])); + t.assertTrue(dojo.isObject(new Array())); + }, + + function isArray(t){ + t.assertTrue(dojo.isArray([])); + t.assertTrue(dojo.isArray(new Array())); + t.assertFalse(dojo.isArray({})); + }, + + function isArrayLike(t){ + t.assertFalse(dojo.isArrayLike("thinger")); + t.assertTrue(dojo.isArrayLike(new Array())); + t.assertFalse(dojo.isArrayLike({})); + t.assertTrue(dojo.isArrayLike(arguments)); + }, + + function isString(t){ + t.assertFalse(dojo.isString(true)); + t.assertFalse(dojo.isString(false)); + t.assertTrue(dojo.isString("foo")); + t.assertTrue(dojo.isString(new String("foo"))); + t.assertFalse(dojo.isString(null)); + t.assertFalse(dojo.isString({})); + t.assertFalse(dojo.isString([])); + }, + + function partial(t){ + var scope = { foo: "bar" }; + var scope2 = { foo: "baz" }; + function thinger(arg1, arg2){ + return [this.foo, arg1, arg2]; + } + + var st1 = dojo.partial(thinger); + t.assertEqual("bar", st1.call(scope)[0]); + t.assertEqual(undefined, st1()[0]); + var st2 = dojo.partial(thinger, "foo", "bar"); + t.assertEqual("bar", st2()[2]); + var st3 = dojo.partial(thinger, "foo", "bar"); + }, + + function nestedPartial(t){ + function thinger(arg1, arg2){ + return [arg1, arg2]; + } + + var st1 = dojo.partial(thinger, "foo"); + t.assertEqual(undefined, st1()[1]); + t.assertEqual("bar", st1("bar")[1]); + + // partials can accumulate + var st2 = dojo.partial(st1, "thud"); + t.assertEqual("foo", st2()[0]); + t.assertEqual("thud", st2()[1]); + }, + + function hitch(t){ + var scope = { foo: "bar" }; + var scope2 = { foo: "baz" }; + function thinger(){ + return [this.foo, arguments.length]; + } + + var st1 = dojo.hitch(scope, thinger); + t.assertEqual("bar", st1()[0]); + t.assertEqual(0, st1()[1]); + + var st2 = dojo.hitch(scope2, thinger); + t.assertEqual("baz", st2()[0]); + t.assertEqual(0, st1()[1]); + t.assertEqual(1, st1("blah")[1]); + + // st2 should be "scope proof" + t.assertEqual("baz", st2.call(scope)[0]); + }, + + function hitchWithArgs(t){ + var scope = { foo: "bar" }; + var scope2 = { foo: "baz" }; + function thinger(){ + return [this.foo, arguments.length]; + } + + var st1 = dojo.hitch(scope, thinger, "foo", "bar"); + t.assertEqual("bar", st1()[0]); + t.assertEqual(2, st1()[1]); + var st2 = dojo.hitch(scope2, thinger, "foo", "bar"); + t.assertEqual("baz", st2()[0]); + t.assertEqual(2, st2()[1]); + }, + + function hitchAsPartial(t){ + var scope = { foo: "bar" }; + var scope2 = { foo: "baz" }; + function thinger(arg1, arg2){ + return [this.foo, arg1, arg2]; + } + + var st1 = dojo.hitch(null, thinger); + t.assertEqual("bar", st1.call(scope)[0]); + t.assertEqual(undefined, st1()[0]); + var st2 = dojo.hitch(null, thinger, "foo", "bar"); + t.assertEqual("bar", st2()[2]); + var st3 = dojo.hitch(null, thinger, "foo", "bar"); + }, + + function _toArray(t){ + var obj1 = [ 'foo', 'bar', 'spam', 'ham' ]; + + function thinger(){ + return dojo._toArray(arguments); + } + var obj2 = thinger.apply(this, obj1); + t.assertEqual(obj1[0], obj2[0]); + }, + + function clone(t) { + var obj1 = {foo: 'bar', answer: 42, jan102007: new Date(2007, 0, 10), + baz: { + a: null, + b: [ + 1, "b", 2.3, true, false + //, function(){ return 4; }, /\d+/gm + ] + } + }; + var obj2 = dojo.clone(obj1); + t.assertEqual(obj1.foo, obj2.foo); + t.assertEqual(obj1.answer, obj2.answer); + t.assertEqual(obj1.jan102007, obj2.jan102007); + t.assertEqual(obj1.baz.a, obj2.baz.a); + for(var i = 0; i < obj1.baz.b.length; ++i){ + t.assertEqual(obj1.baz.b[i], obj2.baz.b[i]); + } + } + ] +); + +} diff --git a/includes/js/dojo/tests/_base/query.html b/includes/js/dojo/tests/_base/query.html new file mode 100644 index 0000000..5c92221 --- /dev/null +++ b/includes/js/dojo/tests/_base/query.html @@ -0,0 +1,154 @@ + + + testing dojo.query() + + + + + + +

testing dojo.query()

+
+

h3 span endh3

+ +
+

h3

+ + +
+

h3

+

h3

+ + + + + +
+
+
+
+
+
+ + +
+ + + diff --git a/includes/js/dojo/tests/_base/query.js b/includes/js/dojo/tests/_base/query.js new file mode 100644 index 0000000..20d2fc4 --- /dev/null +++ b/includes/js/dojo/tests/_base/query.js @@ -0,0 +1,9 @@ +if(!dojo._hasResource["tests._base.query"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests._base.query"] = true; +dojo.provide("tests._base.query"); +if(dojo.isBrowser){ + doh.registerUrl("tests._base.query", dojo.moduleUrl("tests", "_base/query.html")); + doh.registerUrl("tests._base.NodeList", dojo.moduleUrl("tests", "_base/NodeList.html")); +} + +} diff --git a/includes/js/dojo/tests/_base/timeout.php b/includes/js/dojo/tests/_base/timeout.php new file mode 100644 index 0000000..560b0d3 --- /dev/null +++ b/includes/js/dojo/tests/_base/timeout.php @@ -0,0 +1,7 @@ + diff --git a/includes/js/dojo/tests/_base/xhr.html b/includes/js/dojo/tests/_base/xhr.html new file mode 100644 index 0000000..ddc1bb4 --- /dev/null +++ b/includes/js/dojo/tests/_base/xhr.html @@ -0,0 +1,404 @@ + + + + testing form and xhr utils + + + + + + +
+ + + +
+
+ + + + + +
+
+ +
+
+ +
+
+ + + +
+ + + diff --git a/includes/js/dojo/tests/_base/xhr.js b/includes/js/dojo/tests/_base/xhr.js new file mode 100644 index 0000000..885bbfe --- /dev/null +++ b/includes/js/dojo/tests/_base/xhr.js @@ -0,0 +1,8 @@ +if(!dojo._hasResource["tests._base.xhr"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests._base.xhr"] = true; +dojo.provide("tests._base.xhr"); +if(dojo.isBrowser){ + doh.registerUrl("tests._base.xhr", dojo.moduleUrl("tests", "_base/xhr.html")); +} + +} diff --git a/includes/js/dojo/tests/_base/xhrDummyMethod.php b/includes/js/dojo/tests/_base/xhrDummyMethod.php new file mode 100644 index 0000000..c9206fe --- /dev/null +++ b/includes/js/dojo/tests/_base/xhrDummyMethod.php @@ -0,0 +1,7 @@ + -- cgit v1.2.3