@@ -25,6 +25,7 @@ describe('promise', function() {
2525
2626
2727 describe ( 'AV.Promise._debugError' , function ( ) {
28+ AV . Promise . _isPromisesAPlusCompliant = true ;
2829 it ( 'should log error' , function ( done ) {
2930 AV . Promise . setDebugError ( true ) ;
3031 var p = new AV . Promise ( ) ;
@@ -34,6 +35,7 @@ describe('promise', function() {
3435 p . resolve ( 100 ) ;
3536 p . finally ( function ( ) {
3637 AV . Promise . setDebugError ( false ) ;
38+ AV . Promise . _isPromisesAPlusCompliant = false ;
3739 done ( ) ;
3840 } ) ;
3941 } ) ;
@@ -198,6 +200,7 @@ describe('promise', function() {
198200 expect ( error ) . to . be ( 1 ) ;
199201 //should be 1 ms
200202 expect ( Date . now ( ) - startDate ) . to . be . within ( 0 , 10 ) ;
203+ AV . Promise . _isPromisesAPlusCompliant = false ;
201204 setTimeout ( done , 500 ) ;
202205 } ) . done ( function ( ret ) {
203206 throw ret ;
@@ -208,6 +211,7 @@ describe('promise', function() {
208211
209212 describe ( 'PromiseAPlusCompliant' , function ( ) {
210213 it ( 'should catch all them.' , function ( done ) {
214+ AV . Promise . _isPromisesAPlusCompliant = true ;
211215 new AV . Promise ( function ( resolve , reject ) {
212216 return resolve ( 123 ) ;
213217 } )
@@ -216,11 +220,14 @@ describe('promise', function() {
216220 } )
217221 . then ( function ( ) { } , function ( error ) {
218222 expect ( error . code ) . to . be ( 1 ) ;
223+ AV . Promise . _isPromisesAPlusCompliant = false ;
219224 done ( ) ;
220225 } )
221226 } ) ;
222227
223228 it ( 'shoud work in order' , function ( done ) {
229+ AV . Promise . _isPromisesAPlusCompliant = true ;
230+
224231 this . timeout ( 10000 ) ;
225232 var ret = [ ] ;
226233 var a = new AV . Promise ( function ( resolve ) {
@@ -255,13 +262,15 @@ describe('promise', function() {
255262 done ( ) ;
256263 } , 300 ) ;
257264 } , 500 ) ;
265+ AV . Promise . _isPromisesAPlusCompliant = false ;
258266 done ( ) ;
259267 } , 300 ) ;
260268
261269 } ) ;
262270 } ) ;
263271
264272 describe ( 'AV.Promise.race' , function ( ) {
273+ AV . Promise . _isPromisesAPlusCompliant = true ;
265274 it ( 'should be called once.' , function ( done ) {
266275 var wasCalled = false ;
267276 AV . Promise . race ( [
@@ -273,10 +282,12 @@ describe('promise', function() {
273282 if ( wasCalled ) throw 'error' ;
274283 wasCalled = true ;
275284 expect ( value ) . to . be ( 1 ) ;
285+ AV . Promise . _isPromisesAPlusCompliant = false ;
276286 done ( ) ;
277287 } ) ;
278288 } ) ;
279289 it ( 'should run all promises.' , function ( done ) {
290+ AV . Promise . _isPromisesAPlusCompliant = true ;
280291 var results = [ ] ;
281292 var timerPromisefy2 = function ( delay ) {
282293 return new AV . Promise ( function ( resolve , reject ) {
@@ -307,6 +318,7 @@ describe('promise', function() {
307318 expect ( results [ 1 ] ) . to . be ( 32 ) ;
308319 expect ( results [ 2 ] ) . to . be ( 64 ) ;
309320 expect ( results [ 3 ] ) . to . be ( 128 ) ;
321+ AV . Promise . _isPromisesAPlusCompliant = false ;
310322 done ( ) ;
311323 } , 500 ) ;
312324 } ) ;
0 commit comments