@@ -16,12 +16,15 @@ import {
1616import { PromiseWrapper , TimerWrapper } from 'angular2/src/facade/async' ;
1717import { ListWrapper } from 'angular2/src/facade/collection' ;
1818import { BaseException } from 'angular2/src/facade/lang' ;
19+ import { DOM } from 'angular2/src/dom/dom_adapter' ;
1920
2021import { NgZone } from 'angular2/src/core/zone/ng_zone' ;
2122
23+ var isIE = DOM . getUserAgent ( ) . indexOf ( "Trident" ) > - 1 ;
2224// Schedules a macrotask (using a timer)
23- function macroTask ( fn : Function ) : void {
24- _zone . runOutsideAngular ( ( ) => TimerWrapper . setTimeout ( fn , 1 ) ) ;
25+ function macroTask ( fn : Function , timer = 1 ) : void {
26+ //adds longer timers for passing tests in IE
27+ _zone . runOutsideAngular ( ( ) => TimerWrapper . setTimeout ( fn , isIE ? timer : 1 ) ) ;
2528}
2629
2730// Schedules a microtasks (using a resolved promise .then())
@@ -192,7 +195,7 @@ function commonTests() {
192195 // The microtask (async) is executed after the macrotask (run)
193196 expect ( _log . result ( ) ) . toEqual ( 'onTurnStart; run start; run end; async; onTurnDone' ) ;
194197 async . done ( ) ;
195- } ) ;
198+ } , 50 ) ;
196199 } ) ) ;
197200
198201 it ( 'should not run onTurnStart and onTurnDone for nested Zone.run' ,
@@ -211,7 +214,7 @@ function commonTests() {
211214 macroTask ( ( ) => {
212215 expect ( _log . result ( ) ) . toEqual ( 'onTurnStart; start run; nested run; end run; nested run microtask; onTurnDone' ) ;
213216 async . done ( ) ;
214- } ) ;
217+ } , 50 ) ;
215218 } ) ) ;
216219
217220 it ( 'should call onTurnStart and onTurnDone before and after each top-level run' ,
@@ -256,7 +259,7 @@ function commonTests() {
256259 macroTask ( ( ) => {
257260 expect ( _log . result ( ) ) . toEqual ( 'onTurnStart; run start; onTurnDone; onTurnStart; a then; b then; onTurnDone' ) ;
258261 async . done ( ) ;
259- } ) ;
262+ } , 50 ) ;
260263 } ) ) ;
261264
262265 it ( 'should run a function outside of the angular zone' , inject ( [ AsyncTestCompleter ] , ( async ) => {
@@ -303,7 +306,7 @@ function commonTests() {
303306 'onTurnStart; executedMicrotask; onTurnDone'
304307 ) ;
305308 async . done ( ) ;
306- } ) ;
309+ } , 50 ) ;
307310 } ) ) ;
308311
309312 it ( 'should call onTurnStart before executing a microtask scheduled in onTurnDone as well as ' +
@@ -334,7 +337,7 @@ function commonTests() {
334337 'onTurnStart; executedMicrotask; onTurnDone(begin); onTurnDone(end)'
335338 ) ;
336339 async . done ( ) ;
337- } ) ;
340+ } , 50 ) ;
338341 } ) ) ;
339342
340343 it ( 'should call onTurnStart and onTurnDone for a scheduleMicrotask in onTurnDone triggered by ' +
@@ -369,8 +372,7 @@ function commonTests() {
369372 'onTurnStart; onTurnDone(executeMicrotask); onTurnDone(begin); onTurnDone(end)'
370373 ) ;
371374 async . done ( ) ;
372-
373- } ) ;
375+ } , 50 ) ;
374376 } ) ) ;
375377
376378 it ( 'should execute promises scheduled in onTurnStart before promises scheduled in run' ,
@@ -426,7 +428,7 @@ function commonTests() {
426428 'onTurnStart(begin); onTurnStart(end); onTurnDone(executePromise); onTurnDone(begin); onTurnDone(end)'
427429 ) ;
428430 async . done ( ) ;
429- } ) ;
431+ } , 50 ) ;
430432 } ) ) ;
431433
432434 it ( 'should call onTurnStart and onTurnDone before and after each turn, respectively' ,
@@ -447,14 +449,14 @@ function commonTests() {
447449 _zone . run ( ( ) => {
448450 completerA . resolve ( null ) ;
449451 } ) ;
450- } ) ;
452+ } , 10 ) ;
451453
452454
453455 macroTask ( ( ) => {
454456 _zone . run ( ( ) => {
455457 completerB . resolve ( null ) ;
456458 } ) ;
457- } ) ;
459+ } , 30 ) ;
458460
459461 macroTask ( ( ) => {
460462 expect ( _log . result ( ) ) . toEqual (
@@ -465,7 +467,7 @@ function commonTests() {
465467 // Third VM turn
466468 'onTurnStart; b then; onTurnDone' ) ;
467469 async . done ( ) ;
468- } ) ;
470+ } , 60 ) ;
469471 } ) ) ;
470472
471473 it ( 'should call onTurnStart and onTurnDone before and after (respectively) all turns in a chain' ,
@@ -484,7 +486,7 @@ function commonTests() {
484486 macroTask ( ( ) => {
485487 expect ( _log . result ( ) ) . toEqual ( 'onTurnStart; run start; run end; async1; async2; onTurnDone' ) ;
486488 async . done ( ) ;
487- } ) ;
489+ } , 50 ) ;
488490 } ) ) ;
489491
490492 it ( 'should call onTurnStart and onTurnDone for promises created outside of run body' ,
@@ -505,7 +507,7 @@ function commonTests() {
505507 macroTask ( ( ) => {
506508 expect ( _log . result ( ) ) . toEqual ( 'onTurnStart; zone run; onTurnDone; onTurnStart; promise then; onTurnDone' ) ;
507509 async . done ( ) ;
508- } ) ;
510+ } , 50 ) ;
509511 } ) ) ;
510512 } ) ;
511513
@@ -541,7 +543,7 @@ function commonTests() {
541543 expect ( _errors . length ) . toBe ( 1 ) ;
542544 expect ( _errors [ 0 ] ) . toEqual ( exception ) ;
543545 async . done ( ) ;
544- } ) ;
546+ } , 50 ) ;
545547 } ) ) ;
546548
547549 it ( 'should call onError when onTurnDone throws and the zone is sync' ,
@@ -561,7 +563,7 @@ function commonTests() {
561563 expect ( _errors . length ) . toBe ( 1 ) ;
562564 expect ( _errors [ 0 ] ) . toEqual ( exception ) ;
563565 async . done ( ) ;
564- } ) ;
566+ } , 50 ) ;
565567 } ) ) ;
566568
567569 it ( 'should call onError when onTurnDone throws and the zone is async' ,
@@ -587,7 +589,7 @@ function commonTests() {
587589 expect ( _errors . length ) . toBe ( 1 ) ;
588590 expect ( _errors [ 0 ] ) . toEqual ( exception ) ;
589591 async . done ( ) ;
590- } ) ;
592+ } , 50 ) ;
591593 } ) ) ;
592594 } ) ;
593595}
0 commit comments