summaryrefslogtreecommitdiff
path: root/includes/js/dojo/tests/DeferredList.js
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-14 15:39:19 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-14 15:39:19 +0000
commit1c5685d68f1b73270fb814fe04cbb490eb90ba5f (patch)
tree3d3ada08a934b96fc31531f1327690d7edc6f766 /includes/js/dojo/tests/DeferredList.js
parent104d59099e048688c4dbac37d72137006e396558 (diff)
downloadsemanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.gz
semanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.bz2
Minor fix: Remove DOJO library (60Mo) replaced by link to Google CDN (online DOJO library)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@159 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojo/tests/DeferredList.js')
-rw-r--r--includes/js/dojo/tests/DeferredList.js206
1 files changed, 0 insertions, 206 deletions
diff --git a/includes/js/dojo/tests/DeferredList.js b/includes/js/dojo/tests/DeferredList.js
deleted file mode 100644
index 9353bfa..0000000
--- a/includes/js/dojo/tests/DeferredList.js
+++ /dev/null
@@ -1,206 +0,0 @@
-if(!dojo._hasResource["tests.DeferredList"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["tests.DeferredList"] = true;
-dojo.provide("tests.DeferredList");
-
-dojo.require("dojo.DeferredList");
-
-doh.register("tests.DeferredList",
- [
- function callback(t){
- var d1 = new dojo.Deferred();
- var d2 = new dojo.Deferred();
- var dl = new dojo.DeferredList([d1, d2]);
- var fired = false;
-
- dl.addCallback(function(res){
- doh.debug("debug from dojo.DeferredList callback");
- return res;
- });
- dl.addCallback(function(res){
- console.log("res: ", res, res.length);
- t.assertTrue(res.length == 2);
- t.assertTrue(res[0][0]);
- t.assertEqual(res[0][1], "foo");
- t.assertTrue(res[1][0]);
- t.assertEqual(res[1][1], "bar");
- fired = true;
- return res;
- });
- d1.callback("foo");
- d2.callback("bar");
- t.assertTrue(fired);
- },
-
- function errback(t){
- var d1 = new dojo.Deferred();
- var d2 = new dojo.Deferred();
- var dl = new dojo.DeferredList([d1, d2]);
- var fired = false;
- var e1 = new Error("foo");
- var e2 = new Error("bar");
-
- dl.addCallback(function(res){
- doh.debug("debug from dojo.DeferredList callback");
- return res;
- });
- dl.addCallback(function(res){
- t.assertTrue(res.length == 2);
- t.assertTrue(!res[0][0]);
-
- t.assertEqual(res[0][1], e1);
- t.assertTrue(!res[1][0]);
- t.assertEqual(res[1][1], e2);
- fired = true;
- return res;
- });
- d1.errback(e1);
- d2.errback(e2);
- t.assertTrue(fired);
- },
-
-
- function mixed(t){
- var d1 = new dojo.Deferred();
- var d2 = new dojo.Deferred();
- var dl = new dojo.DeferredList([d1, d2]);
- var fired = false;
- var e = new Error("foo");
-
- dl.addCallback(function(res){
- doh.debug("debug from dojo.DeferredList callback");
- return res;
- });
- dl.addCallback(function(res){
- t.assertTrue(res.length == 2);
- t.assertTrue(!res[0][0]);
-
- t.assertEqual(res[0][1], e);
- t.assertTrue(res[1][0]);
- t.assertEqual(res[1][1], "bar");
- fired = true;
- return res;
- });
- d1.errback(e);
- d2.callback("bar");
- t.assertTrue(fired);
- },
-
- function gather(t){
- var d1 = new dojo.Deferred();
- var d2 = new dojo.Deferred();
- var dl = dojo.DeferredList.prototype.gatherResults([d1, d2]);
- var fired = false;
- dl.addCallback(function(res){
- t.assertEqual(res[0], "foo");
- t.assertEqual(res[1], "bar");
- fired = true;
- return res;
- });
- d1.callback("foo");
- d2.callback("bar");
- t.assertTrue(fired);
- }
- ]
-);
-dojo.provide("tests.DeferredList");
-
-dojo.require("dojo.DeferredList");
-
-doh.register("tests.DeferredList",
- [
- function callback(t){
- var d1 = new dojo.Deferred();
- var d2 = new dojo.Deferred();
- var dl = new dojo.DeferredList([d1, d2]);
- var fired = false;
- dl.addCallback(function(res){
- doh.debug("debug from dojo.DeferredList callback");
- return res;
- });
- dl.addCallback(function(res){
- t.assertTrue(res.length == 2);
- t.assertTrue(res[0][0]);
- t.assertEqual(res[0][1], "foo");
- t.assertTrue(res[1][0]);
- t.assertEqual(res[1][1], "bar");
- fired = true;
- return res;
- });
- d1.callback("foo");
- d2.callback("bar");
- t.assertTrue(fired);
- },
-
- function errback(t){
- var d1 = new dojo.Deferred();
- var d2 = new dojo.Deferred();
- var dl = new dojo.DeferredList([d1, d2]);
- var fired = false;
- var e1 = new Error("foo");
- var e2 = new Error("bar");
-
- dl.addCallback(function(res){
- doh.debug("debug from dojo.DeferredList callback");
- return res;
- });
- dl.addCallback(function(res){
- t.assertTrue(res.length == 2);
- t.assertTrue(!res[0][0]);
-
- t.assertEqual(res[0][1], e1);
- t.assertTrue(!res[1][0]);
- t.assertEqual(res[1][1], e2);
- fired = true;
- return res;
- });
- d1.errback(e1);
- d2.errback(e2);
- t.assertTrue(fired);
- },
-
-
- function mixed(t){
- var d1 = new dojo.Deferred();
- var d2 = new dojo.Deferred();
- var dl = new dojo.DeferredList([d1, d2]);
- var fired = false;
- var e = new Error("foo");
-
- dl.addCallback(function(res){
- doh.debug("debug from dojo.DeferredList callback");
- return res;
- });
- dl.addCallback(function(res){
- t.assertTrue(res.length == 2);
- t.assertTrue(!res[0][0]);
-
- t.assertEqual(res[0][1], e);
- t.assertTrue(res[1][0]);
- t.assertEqual(res[1][1], "bar");
- fired = true;
- return res;
- });
- d1.errback(e);
- d2.callback("bar");
- t.assertTrue(fired);
- },
-
- function gather(t){
- var d1 = new dojo.Deferred();
- var d2 = new dojo.Deferred();
- var dl = dojo.DeferredList.prototype.gatherResults([d1, d2]);
- var fired = false;
- dl.addCallback(function(res){
- t.assertEqual(res[0], "foo");
- t.assertEqual(res[1], "bar");
- fired = true;
- return res;
- });
- d1.callback("foo");
- d2.callback("bar");
- t.assertTrue(fired);
- }
- ]
-);
-
-}