[Pkg-javascript-commits] [dojo] 66/88: Revise conditions under which dojo/when creates a promise; fixes #16667 in 1.8 branch !strict
David Prévot
taffit at moszumanska.debian.org
Thu Aug 21 17:39:39 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag 1.8.5
in repository dojo.
commit dee9638b21ae12883754364b5ad060992bf7352b
Author: Kenneth G. Franqueiro <kenneth.franqueiro at gmail.com>
Date: Sun Feb 17 18:47:09 2013 +0000
Revise conditions under which dojo/when creates a promise; fixes #16667 in 1.8 branch !strict
git-svn-id: http://svn.dojotoolkit.org/src/branches/1.8/dojo@30606 560b804f-0ae3-0310-86f3-f6aa0a117693
---
tests/when.js | 6 ++++++
when.js | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/tests/when.js b/tests/when.js
index e8b12dd..a90c55a 100644
--- a/tests/when.js
+++ b/tests/when.js
@@ -14,6 +14,12 @@ define([
t.t(this.deferred.promise === promise2);
},
+ "when() doesn't convert to promise if errback is passed but no callback": function(t){
+ var obj = {};
+ var result = when(obj, null, function(){});
+ t.t(result === obj);
+ },
+
"when() with a result value": function(t){
var obj = {};
var received;
diff --git a/when.js b/when.js
index 23c327c..36704ad 100644
--- a/when.js
+++ b/when.js
@@ -36,8 +36,8 @@ define([
var nativePromise = receivedPromise && valueOrPromise instanceof Promise;
if(!receivedPromise){
- if(callback){
- return callback(valueOrPromise);
+ if(arguments.length > 1){
+ return callback ? callback(valueOrPromise) : valueOrPromise;
}else{
return new Deferred().resolve(valueOrPromise);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git
More information about the Pkg-javascript-commits
mailing list