fix: remove deprecated zone API usage in testability

Closes #5084
This commit is contained in:
Yegor Jbanov
2015-11-03 18:45:55 -08:00
committed by Yegor
parent 6133f2c08b
commit 3593d85807
2 changed files with 24 additions and 19 deletions
@@ -4,7 +4,7 @@ import {Map, MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'
import {CONST, CONST_EXPR} from 'angular2/src/core/facade/lang';
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
import {NgZone} from '../zone/ng_zone';
import {PromiseWrapper} from 'angular2/src/core/facade/async';
import {PromiseWrapper, ObservableWrapper} from 'angular2/src/core/facade/async';
/**
@@ -24,11 +24,17 @@ export class Testability {
/** @internal */
_watchAngularEvents(_ngZone: NgZone): void {
_ngZone.overrideOnTurnStart(() => { this._isAngularEventPending = true; });
_ngZone.overrideOnEventDone(() => {
this._isAngularEventPending = false;
this._runCallbacksIfReady();
}, true);
ObservableWrapper.subscribe(_ngZone.onTurnStart,
(_) => { this._isAngularEventPending = true; });
_ngZone.runOutsideAngular(() => {
ObservableWrapper.subscribe(_ngZone.onEventDone, (_) => {
if (!_ngZone.hasPendingTimers) {
this._isAngularEventPending = false;
this._runCallbacksIfReady();
}
});
});
}
increasePendingRequestCount(): number {