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.js | |
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.js')
-rw-r--r-- | includes/js/dojo/tests/_base.js | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/includes/js/dojo/tests/_base.js b/includes/js/dojo/tests/_base.js new file mode 100644 index 0000000..7bc5301 --- /dev/null +++ b/includes/js/dojo/tests/_base.js @@ -0,0 +1,136 @@ +if(!dojo._hasResource["tests._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests._base"] = true; +var testGlobal = this; +try{ + dojo.provide("tests._base"); + testGlobal = dojo.global; +}catch(e){ } + +// the test suite for the bootstrap. Requires hostenv and other base tests at +// the end + +if(doh.selfTest){ + + doh.register("doh.smokeTest", + [ + function sanityCheckHarness(t){ + // sanity checks + t.assertTrue(true); + t.assertFalse(false); + t.assertFalse(0); + t.assertFalse(null); + var tObj = { w00t: false, blarg: true }; + t.assertEqual( + ["thinger", "blah", tObj], + ["thinger", "blah", tObj] + ); + t.assertEqual(tObj, tObj); + }, + /* + // uncomment to tests exception handling + function sanityCheckassertTrue(t){ + // should throw an error + t.assertTrue(false); + }, + function sanityCheckassertFalse(t){ + // should throw an error + t.assertFalse(true); + }, + function sanityCheckassertEqual(t){ + // should throw an error + t.assertEqual("foo", "bar"); + }, + */ + { + name: "eqTest", + // smoke test the fixture system + setUp: function(t){ + this.foo = "blah"; + }, + runTest: function(t){ + t.assertEqual("blah", this.foo); + }, + tearDown: function(t){ + } + } + ] + ); + + if(testGlobal["dojo"]){ + doh.register("tests._base", + [ + function dojoIsAvailable(t){ + t.assertTrue(testGlobal["dojo"]); + } + ] + ); + } + + if(testGlobal["setTimeout"]){ + // a stone-stupid async test + doh.register("tests.async", + [ + { + name: "deferredSuccess", + runTest: function(t){ + var d = new doh.Deferred(); + setTimeout(d.getTestCallback(function(){ + t.assertTrue(true); + t.assertFalse(false); + }), 50); + return d; + } + }, + { + name: "deferredFailure", + runTest: function(t){ + var d = new doh.Deferred(); + setTimeout(function(){ + d.errback(new Error("hrm...")); + }, 50); + return d; + } + }, + { + name: "timeoutFailure", + timeout: 50, + runTest: function(t){ + // timeout of 50 + var d = new doh.Deferred(); + setTimeout(function(){ + d.callback(true); + }, 100); + return d; + } + } + ] + ); + } +} + +try{ + // go grab the others + dojo.require("tests._base._loader.bootstrap"); + dojo.require("tests._base._loader.loader"); + dojo.platformRequire({ + browser: ["tests._base._loader.hostenv_browser"], + rhino: ["tests._base._loader.hostenv_rhino"], + spidermonkey: ["tests._base._loader.hostenv_spidermonkey"] + }); + dojo.require("tests._base.array"); + dojo.require("tests._base.Color"); + dojo.require("tests._base.lang"); + dojo.require("tests._base.declare"); + dojo.require("tests._base.connect"); + dojo.require("tests._base.Deferred"); + dojo.require("tests._base.json"); + // FIXME: add test includes for the rest of the Dojo Base groups here + dojo.requireIf(dojo.isBrowser, "tests._base.html"); + dojo.requireIf(dojo.isBrowser, "tests._base.fx"); + dojo.requireIf(dojo.isBrowser, "tests._base.query"); + dojo.requireIf(dojo.isBrowser, "tests._base.xhr"); +}catch(e){ + doh.debug(e); +} + +} |