source: trip-planner-front/node_modules/zone.js/bundles/fake-async-test.umd.min.js@ fa375fe

Last change on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 13.0 KB
Line 
1"use strict";var __spreadArrays=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var i=Array(e),n=0;for(t=0;t<r;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i};
2/**
3 * @license Angular v12.0.0-next.0
4 * (c) 2010-2020 Google LLC. https://angular.io/
5 * License: MIT
6 */!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){
7/**
8 * @license
9 * Copyright Google LLC All Rights Reserved.
10 *
11 * Use of this source code is governed by an MIT-style license that can be
12 * found in the LICENSE file at https://angular.io/license
13 */
14!function(e){var t=e.Date;function r(){if(0===arguments.length){var e=new t;return e.setTime(r.now()),e}var i=Array.prototype.slice.call(arguments);return new(t.bind.apply(t,__spreadArrays([void 0],i)))}r.now=function(){var e=Zone.current.get("FakeAsyncTestZoneSpec");return e?e.getFakeSystemTime():t.now.apply(this,arguments)},r.UTC=t.UTC,r.parse=t.parse;var i={setTimeout:e.setTimeout,setInterval:e.setInterval,clearTimeout:e.clearTimeout,clearInterval:e.clearInterval},n=function(){function r(){this._schedulerQueue=[],this._currentTickTime=0,this._currentFakeBaseSystemTime=t.now(),this._currentTickRequeuePeriodicEntries=[]}return r.prototype.getCurrentTickTime=function(){return this._currentTickTime},r.prototype.getFakeSystemTime=function(){return this._currentFakeBaseSystemTime+this._currentTickTime},r.prototype.setFakeBaseSystemTime=function(e){this._currentFakeBaseSystemTime=e},r.prototype.getRealSystemTime=function(){return t.now()},r.prototype.scheduleFunction=function(e,t,i){var n=(i=Object.assign({args:[],isPeriodic:!1,isRequestAnimationFrame:!1,id:-1,isRequeuePeriodic:!1},i)).id<0?r.nextId++:i.id,s={endTime:this._currentTickTime+t,id:n,func:e,args:i.args,delay:t,isPeriodic:i.isPeriodic,isRequestAnimationFrame:i.isRequestAnimationFrame};i.isRequeuePeriodic&&this._currentTickRequeuePeriodicEntries.push(s);for(var o=0;o<this._schedulerQueue.length&&!(s.endTime<this._schedulerQueue[o].endTime);o++);return this._schedulerQueue.splice(o,0,s),n},r.prototype.removeScheduledFunctionWithId=function(e){for(var t=0;t<this._schedulerQueue.length;t++)if(this._schedulerQueue[t].id==e){this._schedulerQueue.splice(t,1);break}},r.prototype.removeAll=function(){this._schedulerQueue=[]},r.prototype.getTimerCount=function(){return this._schedulerQueue.length},r.prototype.tickToNext=function(e,t,r){void 0===e&&(e=1),this._schedulerQueue.length<e||this.tick(this._schedulerQueue[e-1].endTime-this._currentTickTime,t,r)},r.prototype.tick=function(t,r,i){void 0===t&&(t=0);var n=this._currentTickTime+t,s=0,o=(i=Object.assign({processNewMacroTasksSynchronously:!0},i)).processNewMacroTasksSynchronously?this._schedulerQueue:this._schedulerQueue.slice();if(0===o.length&&r)r(t);else{for(;o.length>0&&(this._currentTickRequeuePeriodicEntries=[],!(n<o[0].endTime));){var a=o.shift();if(!i.processNewMacroTasksSynchronously){var c=this._schedulerQueue.indexOf(a);c>=0&&this._schedulerQueue.splice(c,1)}if(s=this._currentTickTime,this._currentTickTime=a.endTime,r&&r(this._currentTickTime-s),!a.func.apply(e,a.isRequestAnimationFrame?[this._currentTickTime]:a.args))break;i.processNewMacroTasksSynchronously||this._currentTickRequeuePeriodicEntries.forEach((function(e){for(var t=0;t<o.length&&!(e.endTime<o[t].endTime);t++);o.splice(t,0,e)}))}s=this._currentTickTime,this._currentTickTime=n,r&&r(this._currentTickTime-s)}},r.prototype.flushOnlyPendingTimers=function(e){if(0===this._schedulerQueue.length)return 0;var t=this._currentTickTime;return this.tick(this._schedulerQueue[this._schedulerQueue.length-1].endTime-t,e,{processNewMacroTasksSynchronously:!1}),this._currentTickTime-t},r.prototype.flush=function(e,t,r){return void 0===e&&(e=20),void 0===t&&(t=!1),t?this.flushPeriodic(r):this.flushNonPeriodic(e,r)},r.prototype.flushPeriodic=function(e){if(0===this._schedulerQueue.length)return 0;var t=this._currentTickTime;return this.tick(this._schedulerQueue[this._schedulerQueue.length-1].endTime-t,e),this._currentTickTime-t},r.prototype.flushNonPeriodic=function(t,r){for(var i=this._currentTickTime,n=0,s=0;this._schedulerQueue.length>0;){if(++s>t)throw new Error("flush failed after reaching the limit of "+t+" tasks. Does your code use a polling timeout?");if(0===this._schedulerQueue.filter((function(e){return!e.isPeriodic&&!e.isRequestAnimationFrame})).length)break;var o=this._schedulerQueue.shift();if(n=this._currentTickTime,this._currentTickTime=o.endTime,r&&r(this._currentTickTime-n),!o.func.apply(e,o.args))break}return this._currentTickTime-i},r}();n.nextId=1;var s=function(){function s(t,r,i){void 0===r&&(r=!1),this.trackPendingRequestAnimationFrame=r,this.macroTaskOptions=i,this._scheduler=new n,this._microtasks=[],this._lastError=null,this._uncaughtPromiseErrors=Promise[Zone.__symbol__("uncaughtPromiseErrors")],this.pendingPeriodicTimers=[],this.pendingTimers=[],this.patchDateLocked=!1,this.properties={FakeAsyncTestZoneSpec:this},this.name="fakeAsyncTestZone for "+t,this.macroTaskOptions||(this.macroTaskOptions=e[Zone.__symbol__("FakeAsyncTestMacroTask")])}return s.assertInZone=function(){if(null==Zone.current.get("FakeAsyncTestZoneSpec"))throw new Error("The code should be running in the fakeAsync zone to call this function")},s.prototype._fnAndFlush=function(t,r){var i=this;return function(){for(var n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];return t.apply(e,n),null===i._lastError?(null!=r.onSuccess&&r.onSuccess.apply(e),i.flushMicrotasks()):null!=r.onError&&r.onError.apply(e),null===i._lastError}},s._removeTimer=function(e,t){var r=e.indexOf(t);r>-1&&e.splice(r,1)},s.prototype._dequeueTimer=function(e){var t=this;return function(){s._removeTimer(t.pendingTimers,e)}},s.prototype._requeuePeriodicTimer=function(e,t,r,i){var n=this;return function(){-1!==n.pendingPeriodicTimers.indexOf(i)&&n._scheduler.scheduleFunction(e,t,{args:r,isPeriodic:!0,id:i,isRequeuePeriodic:!0})}},s.prototype._dequeuePeriodicTimer=function(e){var t=this;return function(){s._removeTimer(t.pendingPeriodicTimers,e)}},s.prototype._setTimeout=function(e,t,r,i){void 0===i&&(i=!0);var s=this._dequeueTimer(n.nextId),o=this._fnAndFlush(e,{onSuccess:s,onError:s}),a=this._scheduler.scheduleFunction(o,t,{args:r,isRequestAnimationFrame:!i});return i&&this.pendingTimers.push(a),a},s.prototype._clearTimeout=function(e){s._removeTimer(this.pendingTimers,e),this._scheduler.removeScheduledFunctionWithId(e)},s.prototype._setInterval=function(e,t,r){var i=n.nextId,s={onSuccess:null,onError:this._dequeuePeriodicTimer(i)},o=this._fnAndFlush(e,s);return s.onSuccess=this._requeuePeriodicTimer(o,t,r,i),this._scheduler.scheduleFunction(o,t,{args:r,isPeriodic:!0}),this.pendingPeriodicTimers.push(i),i},s.prototype._clearInterval=function(e){s._removeTimer(this.pendingPeriodicTimers,e),this._scheduler.removeScheduledFunctionWithId(e)},s.prototype._resetLastErrorAndThrow=function(){var e=this._lastError||this._uncaughtPromiseErrors[0];throw this._uncaughtPromiseErrors.length=0,this._lastError=null,e},s.prototype.getCurrentTickTime=function(){return this._scheduler.getCurrentTickTime()},s.prototype.getFakeSystemTime=function(){return this._scheduler.getFakeSystemTime()},s.prototype.setFakeBaseSystemTime=function(e){this._scheduler.setFakeBaseSystemTime(e)},s.prototype.getRealSystemTime=function(){return this._scheduler.getRealSystemTime()},s.patchDate=function(){e[Zone.__symbol__("disableDatePatching")]||e.Date!==r&&(e.Date=r,r.prototype=t.prototype,s.checkTimerPatch())},s.resetDate=function(){e.Date===r&&(e.Date=t)},s.checkTimerPatch=function(){e.setTimeout!==i.setTimeout&&(e.setTimeout=i.setTimeout,e.clearTimeout=i.clearTimeout),e.setInterval!==i.setInterval&&(e.setInterval=i.setInterval,e.clearInterval=i.clearInterval)},s.prototype.lockDatePatch=function(){this.patchDateLocked=!0,s.patchDate()},s.prototype.unlockDatePatch=function(){this.patchDateLocked=!1,s.resetDate()},s.prototype.tickToNext=function(e,t,r){void 0===e&&(e=1),void 0===r&&(r={processNewMacroTasksSynchronously:!0}),e<=0||(s.assertInZone(),this.flushMicrotasks(),this._scheduler.tickToNext(e,t,r),null!==this._lastError&&this._resetLastErrorAndThrow())},s.prototype.tick=function(e,t,r){void 0===e&&(e=0),void 0===r&&(r={processNewMacroTasksSynchronously:!0}),s.assertInZone(),this.flushMicrotasks(),this._scheduler.tick(e,t,r),null!==this._lastError&&this._resetLastErrorAndThrow()},s.prototype.flushMicrotasks=function(){for(s.assertInZone();this._microtasks.length>0;){var e=this._microtasks.shift();e.func.apply(e.target,e.args)}(null!==this._lastError||this._uncaughtPromiseErrors.length)&&this._resetLastErrorAndThrow()},s.prototype.flush=function(e,t,r){s.assertInZone(),this.flushMicrotasks();var i=this._scheduler.flush(e,t,r);return null!==this._lastError&&this._resetLastErrorAndThrow(),i},s.prototype.flushOnlyPendingTimers=function(e){s.assertInZone(),this.flushMicrotasks();var t=this._scheduler.flushOnlyPendingTimers(e);return null!==this._lastError&&this._resetLastErrorAndThrow(),t},s.prototype.removeAllTimers=function(){s.assertInZone(),this._scheduler.removeAll(),this.pendingPeriodicTimers=[],this.pendingTimers=[]},s.prototype.getTimerCount=function(){return this._scheduler.getTimerCount()+this._microtasks.length},s.prototype.onScheduleTask=function(e,t,r,i){switch(i.type){case"microTask":var n=i.data&&i.data.args,s=void 0;if(n){var o=i.data.cbIdx;"number"==typeof n.length&&n.length>o+1&&(s=Array.prototype.slice.call(n,o+1))}this._microtasks.push({func:i.invoke,args:s,target:i.data&&i.data.target});break;case"macroTask":switch(i.source){case"setTimeout":i.data.handleId=this._setTimeout(i.invoke,i.data.delay,Array.prototype.slice.call(i.data.args,2));break;case"setImmediate":i.data.handleId=this._setTimeout(i.invoke,0,Array.prototype.slice.call(i.data.args,1));break;case"setInterval":i.data.handleId=this._setInterval(i.invoke,i.data.delay,Array.prototype.slice.call(i.data.args,2));break;case"XMLHttpRequest.send":throw new Error("Cannot make XHRs from within a fake async test. Request URL: "+i.data.url);case"requestAnimationFrame":case"webkitRequestAnimationFrame":case"mozRequestAnimationFrame":i.data.handleId=this._setTimeout(i.invoke,16,i.data.args,this.trackPendingRequestAnimationFrame);break;default:var a=this.findMacroTaskOption(i);if(a){var c=i.data&&i.data.args,u=c&&c.length>1?c[1]:0,h=a.callbackArgs?a.callbackArgs:c;a.isPeriodic?(i.data.handleId=this._setInterval(i.invoke,u,h),i.data.isPeriodic=!0):i.data.handleId=this._setTimeout(i.invoke,u,h);break}throw new Error("Unknown macroTask scheduled in fake async test: "+i.source)}break;case"eventTask":i=e.scheduleTask(r,i)}return i},s.prototype.onCancelTask=function(e,t,r,i){switch(i.source){case"setTimeout":case"requestAnimationFrame":case"webkitRequestAnimationFrame":case"mozRequestAnimationFrame":return this._clearTimeout(i.data.handleId);case"setInterval":return this._clearInterval(i.data.handleId);default:var n=this.findMacroTaskOption(i);if(n){var s=i.data.handleId;return n.isPeriodic?this._clearInterval(s):this._clearTimeout(s)}return e.cancelTask(r,i)}},s.prototype.onInvoke=function(e,t,r,i,n,o,a){try{return s.patchDate(),e.invoke(r,i,n,o,a)}finally{this.patchDateLocked||s.resetDate()}},s.prototype.findMacroTaskOption=function(e){if(!this.macroTaskOptions)return null;for(var t=0;t<this.macroTaskOptions.length;t++){var r=this.macroTaskOptions[t];if(r.source===e.source)return r}return null},s.prototype.onHandleError=function(e,t,r,i){return this._lastError=i,!1},s}();Zone.FakeAsyncTestZoneSpec=s}("object"==typeof window&&window||"object"==typeof self&&self||global),Zone.__load_patch("fakeasync",(function(e,t,r){var i=t&&t.FakeAsyncTestZoneSpec;function n(){return t&&t.ProxyZoneSpec}var s=null;function o(){s&&s.unlockDatePatch(),s=null,n()&&n().assertPresent().resetDelegate()}function a(){if(null==s&&null==(s=t.current.get("FakeAsyncTestZoneSpec")))throw new Error("The code should be running in the fakeAsync zone to call this function");return s}function c(){a().flushMicrotasks()}t[r.symbol("fakeAsyncTest")]={resetFakeAsyncZone:o,flushMicrotasks:c,discardPeriodicTasks:function u(){a().pendingPeriodicTimers.length=0},tick:function h(e,t){void 0===e&&(e=0),void 0===t&&(t=!1),a().tick(e,null,t)},flush:function l(e){return a().flush(e)},fakeAsync:function d(e){var r=function(){for(var r=[],a=0;a<arguments.length;a++)r[a]=arguments[a];var u=n();if(!u)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 h=u.assertPresent();if(t.current.get("FakeAsyncTestZoneSpec"))throw new Error("fakeAsync() calls can not be nested");try{if(!s){if(h.getDelegate()instanceof i)throw new Error("fakeAsync() calls can not be nested");s=new i}var l=void 0,d=h.getDelegate();h.setDelegate(s),s.lockDatePatch();try{l=e.apply(this,r),c()}finally{h.setDelegate(d)}if(s.pendingPeriodicTimers.length>0)throw new Error(s.pendingPeriodicTimers.length+" periodic timer(s) still in the queue.");if(s.pendingTimers.length>0)throw new Error(s.pendingTimers.length+" timer(s) still in the queue.");return l}finally{o()}};return r.isFakeAsync=!0,r}}}),!0)}));
Note: See TracBrowser for help on using the repository browser.