14 | var e,n;e="undefined"!=typeof window&&window||"undefined"!=typeof self&&self||global,(n=function(){function n(n,t,o){this.finishCallback=n,this.failCallback=t,this._pendingMicroTasks=!1,this._pendingMacroTasks=!1,this._alreadyErrored=!1,this._isSync=!1,this.runZone=Zone.current,this.unresolvedChainedPromiseCount=0,this.supportWaitUnresolvedChainedPromise=!1,this.name="asyncTestZone for "+o,this.properties={AsyncTestZoneSpec:this},this.supportWaitUnresolvedChainedPromise=!0===e[Zone.__symbol__("supportWaitUnResolvedChainedPromise")]}return n.prototype.isUnresolvedChainedPromisePending=function(){return this.unresolvedChainedPromiseCount>0},n.prototype._finishCallbackIfDone=function(){var e=this;this._pendingMicroTasks||this._pendingMacroTasks||this.supportWaitUnresolvedChainedPromise&&this.isUnresolvedChainedPromisePending()||this.runZone.run((function(){setTimeout((function(){e._alreadyErrored||e._pendingMicroTasks||e._pendingMacroTasks||e.finishCallback()}),0)}))},n.prototype.patchPromiseForTest=function(){if(this.supportWaitUnresolvedChainedPromise){var e=Promise[Zone.__symbol__("patchPromiseForTest")];e&&e()}},n.prototype.unPatchPromiseForTest=function(){if(this.supportWaitUnresolvedChainedPromise){var e=Promise[Zone.__symbol__("unPatchPromiseForTest")];e&&e()}},n.prototype.onScheduleTask=function(e,t,o,s){return"eventTask"!==s.type&&(this._isSync=!1),"microTask"===s.type&&s.data&&s.data instanceof Promise&&!0===s.data[n.symbolParentUnresolved]&&this.unresolvedChainedPromiseCount--,e.scheduleTask(o,s)},n.prototype.onInvokeTask=function(e,n,t,o,s,i){return"eventTask"!==o.type&&(this._isSync=!1),e.invokeTask(t,o,s,i)},n.prototype.onCancelTask=function(e,n,t,o){return"eventTask"!==o.type&&(this._isSync=!1),e.cancelTask(t,o)},n.prototype.onInvoke=function(e,n,t,o,s,i,r){try{return this._isSync=!0,e.invoke(t,o,s,i,r)}finally{this._isSync&&this._finishCallbackIfDone()}},n.prototype.onHandleError=function(e,n,t,o){return e.handleError(t,o)&&(this.failCallback(o),this._alreadyErrored=!0),!1},n.prototype.onHasTask=function(e,n,t,o){e.hasTask(t,o),"microTask"==o.change?(this._pendingMicroTasks=o.microTask,this._finishCallbackIfDone()):"macroTask"==o.change&&(this._pendingMacroTasks=o.macroTask,this._finishCallbackIfDone())},n}()).symbolParentUnresolved=Zone.__symbol__("parentUnresolved"),Zone.AsyncTestZoneSpec=n,Zone.__load_patch("asynctest",(function(e,n,t){function o(e,t,o,s){var i=n.current,r=n.AsyncTestZoneSpec;if(void 0===r)throw new Error("AsyncTestZoneSpec is needed for the async() test helper but could not be found. Please make sure that your environment includes zone.js/dist/async-test.js");var a=n.ProxyZoneSpec;if(!a)throw new Error("ProxyZoneSpec is needed for the async() test helper but could not be found. Please make sure that your environment includes zone.js/dist/proxy.js");var c=a.get();a.assertPresent();var u=n.current.getZoneWith("ProxyZoneSpec"),h=c.getDelegate();return u.parent.run((function(){var e=new r((function(){c.getDelegate()==e&&c.setDelegate(h),e.unPatchPromiseForTest(),i.run((function(){o()}))}),(function(n){c.getDelegate()==e&&c.setDelegate(h),e.unPatchPromiseForTest(),i.run((function(){s(n)}))}),"test");c.setDelegate(e),e.patchPromiseForTest()})),n.current.runGuarded(e,t)}n[t.symbol("asyncTest")]=function n(t){return e.jasmine?function(e){e||((e=function(){}).fail=function(e){throw e}),o(t,this,e,(function(n){if("string"==typeof n)return e.fail(new Error(n));e.fail(n)}))}:function(){var e=this;return new Promise((function(n,s){o(t,e,n,s)}))}}}))})); |
---|