You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by er...@apache.org on 2015/04/04 13:23:53 UTC
[1/2] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34753 -
Returning strongly typed object in Promise fails (Aleksey and Andrey
Gorbatov)
Repository: flex-sdk
Updated Branches:
refs/heads/develop 151c6fa1e -> b2e06b599
FLEX-34753 - Returning strongly typed object in Promise fails (Aleksey and Andrey Gorbatov)
Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/2867276e
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/2867276e
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/2867276e
Branch: refs/heads/develop
Commit: 2867276ef797d12e13c3bc40ae676b609e1db6a1
Parents: 151c6fa
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Sat Apr 4 13:22:57 2015 +0200
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Sat Apr 4 13:22:57 2015 +0200
----------------------------------------------------------------------
.../projects/apache/src/org/apache/flex/promises/Promise.as | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/2867276e/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as b/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as
index aacd101..ef39926 100644
--- a/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as
+++ b/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as
@@ -182,8 +182,7 @@ public class Promise implements IThenable
try
{
if (result &&
- (typeof(result) === 'object' ||
- typeof(result) === 'function') &&
+ result.hasOwnProperty("then") &&
result.then is Function)
{
doResolve_(result.then, resolve_, reject_);
[2/2] git commit: [flex-sdk] [refs/heads/develop] - Tests for
FLEX-34753
Posted by er...@apache.org.
Tests for FLEX-34753
Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/b2e06b59
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/b2e06b59
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/b2e06b59
Branch: refs/heads/develop
Commit: b2e06b59961588b0de2161c0ee0d5ead58865723
Parents: 2867276
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Sat Apr 4 13:23:28 2015 +0200
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Sat Apr 4 13:23:28 2015 +0200
----------------------------------------------------------------------
.../apache/tests/promises/PromisesTestSuite.as | 3 +
.../tests/promises/cases/PromisesJIRATests.as | 132 +++++++++++++++++++
2 files changed, 135 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b2e06b59/frameworks/projects/apache/tests/promises/PromisesTestSuite.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/tests/promises/PromisesTestSuite.as b/frameworks/projects/apache/tests/promises/PromisesTestSuite.as
index 2fbb424..223a579 100644
--- a/frameworks/projects/apache/tests/promises/PromisesTestSuite.as
+++ b/frameworks/projects/apache/tests/promises/PromisesTestSuite.as
@@ -21,6 +21,7 @@ package promises
{
import promises.cases.PromisesBasicTests;
+import promises.cases.PromisesJIRATests;
[Suite]
[RunWith("org.flexunit.runners.Suite")]
@@ -28,6 +29,8 @@ public class PromisesTestSuite
{
public var promisesBasic:PromisesBasicTests;
+
+ public var promisesJIRA:PromisesJIRATests;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b2e06b59/frameworks/projects/apache/tests/promises/cases/PromisesJIRATests.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/tests/promises/cases/PromisesJIRATests.as b/frameworks/projects/apache/tests/promises/cases/PromisesJIRATests.as
new file mode 100644
index 0000000..ae102c3
--- /dev/null
+++ b/frameworks/projects/apache/tests/promises/cases/PromisesJIRATests.as
@@ -0,0 +1,132 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package promises.cases
+{
+
+import flash.events.TimerEvent;
+import flash.net.URLRequest;
+import flash.utils.Timer;
+
+import flashx.textLayout.debug.assert;
+
+import org.apache.flex.promises.Promise;
+import org.apache.flex.promises.interfaces.IThenable;
+import org.flexunit.asserts.assertEquals;
+import org.flexunit.async.Async;
+
+public class PromisesJIRATests
+{
+
+ //--------------------------------------------------------------------------
+ //
+ // Variables
+ //
+ //--------------------------------------------------------------------------
+
+ private var expected_:*;
+
+ private var promise_:IThenable;
+
+ private var got_:*;
+
+ private var timer_:Timer;
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Methods
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // parseGot_
+ //----------------------------------
+
+ private function parseGot_(value:*):void {
+ this.got_ = value;
+ }
+
+ //----------------------------------
+ // setUp
+ //----------------------------------
+
+ [Before(async)]
+ public function setUp():void
+ {
+ this.timer_ = new Timer(100, 1);
+ }
+
+ //----------------------------------
+ // tearDown
+ //----------------------------------
+
+ [After(async)]
+ public function tearDown():void
+ {
+ this.promise_ = null;
+
+ if (this.timer_)
+ {
+ this.timer_.stop();
+ this.timer_ = null;
+ }
+ }
+
+ //----------------------------------
+ // verifyGotType_
+ //----------------------------------
+
+ private function verifyGotType_(event:TimerEvent, result:*):void {
+ assertEquals(typeof this.expected_, this.got_);
+ }
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Tests
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // test_FLEX34753
+ //----------------------------------
+
+ [Test(async)]
+ public function test_FLEX34753():void
+ {
+ Async.handleEvent(this, timer_, TimerEvent.TIMER_COMPLETE, verifyGotType_);
+
+ timer_.start();
+
+ promise_ = new Promise(function (fulfill:Function = null, reject:Function = null):*
+ {
+ var urlRequest:URLRequest = new URLRequest('http://flex.apache.org');
+
+ fulfill(urlRequest);
+ });
+
+ expected_ = '[object URLRequest]';
+
+ promise_.then(parseGot_);
+ }
+
+}}
\ No newline at end of file