From 207d7d0faca60a073d8dcc8c981eedddf9e2879a Mon Sep 17 00:00:00 2001 From: Igor Oleinikov Date: Mon, 10 Mar 2014 21:26:58 +0400 Subject: [PATCH] promises-a-plus: updated tests of compatibility with implementation libraries --- promises-a-plus/promises-a-plus-tests.ts | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/promises-a-plus/promises-a-plus-tests.ts b/promises-a-plus/promises-a-plus-tests.ts index 5b10b1b6e..5ae93113a 100644 --- a/promises-a-plus/promises-a-plus-tests.ts +++ b/promises-a-plus/promises-a-plus-tests.ts @@ -1,5 +1,8 @@ /// /// +/// +/// +/// var thenNum: PromisesAPlus.Thenable; var thenStr: PromisesAPlus.Thenable; @@ -35,7 +38,44 @@ function testCompatibleWithRxJS() { var obsNum: Rx.Observable; + // implementation usage thenNum = obsNum.toPromise>(impl); thenNum = obsNum.toPromise(impl); obsNum.toPromise(PromiseImpl); } + +function testCompatibleWithES6Promises() { + // from spec to ES6 + var es6ThenNum: Thenable = thenNum; + var es6ThenStr: Thenable = thenStr; + + // from ES6 to spec + thenNum = es6ThenNum; + thenStr = es6ThenStr; + + // implementation + impl = Promise; +} + +function testCompatibleWithQ() { + // from spec to ES6 + var qThenNum: Q.IPromise = thenNum; + var qThenStr: Q.IPromise = thenStr; + + // from ES6 to spec + thenNum = qThenNum; + thenStr = qThenStr; + + // there's no standart implementation with constructor behaviour +} + +function testCompatibleWithWhen() { + var whenPromiseNum: When.Promise; + var whenPromiseStr: When.Promise; + + // from ES6 to spec + thenNum = whenPromiseNum; + thenStr = whenPromiseStr; + + // there's no standart implementation with constructor behaviour +}