source: trip-planner-front/node_modules/zone.js/fesm2015/zone-testing.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: 32.6 KB
Line 
1"use strict";
2/**
3 * @license Angular v12.0.0-next.0
4 * (c) 2010-2020 Google LLC. https://angular.io/
5 * License: MIT
6 */
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 */const NEWLINE="\n",IGNORE_FRAMES={},creationTrace="__creationTrace__",ERROR_TAG="STACKTRACE TRACKING",SEP_TAG="__SEP_TAG__";let sepTemplate=SEP_TAG+"@[native]";class LongStackTrace{constructor(){this.error=getStacktrace(),this.timestamp=new Date}}function getStacktraceWithUncaughtError(){return new Error(ERROR_TAG)}function getStacktraceWithCaughtError(){try{throw getStacktraceWithUncaughtError()}catch(e){return e}}const error=getStacktraceWithUncaughtError(),caughtError=getStacktraceWithCaughtError(),getStacktrace=error.stack?getStacktraceWithUncaughtError:caughtError.stack?getStacktraceWithCaughtError:getStacktraceWithUncaughtError;function getFrames(e){return e.stack?e.stack.split("\n"):[]}function addErrorStack(e,t){let n=getFrames(t);for(let t=0;t<n.length;t++)IGNORE_FRAMES.hasOwnProperty(n[t])||e.push(n[t])}function renderLongStackTrace(e,t){const n=[t?t.trim():""];if(e){let t=(new Date).getTime();for(let r=0;r<e.length;r++){const s=e[r],i=s.timestamp;let o=`____________________Elapsed ${t-i.getTime()} ms; At: ${i}`;o=o.replace(/[^\w\d]/g,"_"),n.push(sepTemplate.replace(SEP_TAG,o)),addErrorStack(n,s.error),t=i.getTime()}}return n.join("\n")}function stackTracesEnabled(){return Error.stackTraceLimit>0}function captureStackTraces(e,t){t>0&&(e.push(getFrames((new LongStackTrace).error)),captureStackTraces(e,t-1))}function computeIgnoreFrames(){if(!stackTracesEnabled())return;const e=[];captureStackTraces(e,2);const t=e[0],n=e[1];for(let e=0;e<t.length;e++){const n=t[e];if(-1==n.indexOf(ERROR_TAG)){let e=n.match(/^\s*at\s+/);if(e){sepTemplate=e[0]+SEP_TAG+" (http://localhost)";break}}}for(let e=0;e<t.length;e++){const r=t[e];if(r!==n[e])break;IGNORE_FRAMES[r]=!0}}Zone.longStackTraceZoneSpec={name:"long-stack-trace",longStackTraceLimit:10,getLongStackTrace:function(e){if(!e)return;const t=e[Zone.__symbol__("currentTaskTrace")];return t?renderLongStackTrace(t,e.stack):e.stack},onScheduleTask:function(e,t,n,r){if(stackTracesEnabled()){const e=Zone.currentTask;let t=e&&e.data&&e.data[creationTrace]||[];t=[new LongStackTrace].concat(t),t.length>this.longStackTraceLimit&&(t.length=this.longStackTraceLimit),r.data||(r.data={}),"eventTask"===r.type&&(r.data=Object.assign({},r.data)),r.data[creationTrace]=t}return e.scheduleTask(n,r)},onHandleError:function(e,t,n,r){if(stackTracesEnabled()){const e=Zone.currentTask||r.task;if(r instanceof Error&&e){const t=renderLongStackTrace(e.data&&e.data[creationTrace],r.stack);try{r.stack=r.longStack=t}catch(e){}}}return e.handleError(n,r)}},computeIgnoreFrames();
14/**
15 * @license
16 * Copyright Google LLC All Rights Reserved.
17 *
18 * Use of this source code is governed by an MIT-style license that can be
19 * found in the LICENSE file at https://angular.io/license
20 */
21class ProxyZoneSpec{constructor(e=null){this.defaultSpecDelegate=e,this.name="ProxyZone",this._delegateSpec=null,this.properties={ProxyZoneSpec:this},this.propertyKeys=null,this.lastTaskState=null,this.isNeedToTriggerHasTask=!1,this.tasks=[],this.setDelegate(e)}static get(){return Zone.current.get("ProxyZoneSpec")}static isLoaded(){return ProxyZoneSpec.get()instanceof ProxyZoneSpec}static assertPresent(){if(!ProxyZoneSpec.isLoaded())throw new Error("Expected to be running in 'ProxyZone', but it was not found.");return ProxyZoneSpec.get()}setDelegate(e){const t=this._delegateSpec!==e;this._delegateSpec=e,this.propertyKeys&&this.propertyKeys.forEach(e=>delete this.properties[e]),this.propertyKeys=null,e&&e.properties&&(this.propertyKeys=Object.keys(e.properties),this.propertyKeys.forEach(t=>this.properties[t]=e.properties[t])),t&&this.lastTaskState&&(this.lastTaskState.macroTask||this.lastTaskState.microTask)&&(this.isNeedToTriggerHasTask=!0)}getDelegate(){return this._delegateSpec}resetDelegate(){this.getDelegate(),this.setDelegate(this.defaultSpecDelegate)}tryTriggerHasTask(e,t,n){this.isNeedToTriggerHasTask&&this.lastTaskState&&(this.isNeedToTriggerHasTask=!1,this.onHasTask(e,t,n,this.lastTaskState))}removeFromTasks(e){if(this.tasks)for(let t=0;t<this.tasks.length;t++)if(this.tasks[t]===e)return void this.tasks.splice(t,1)}getAndClearPendingTasksInfo(){if(0===this.tasks.length)return"";const e="--Pending async tasks are: ["+this.tasks.map(e=>{const t=e.data&&Object.keys(e.data).map(t=>t+":"+e.data[t]).join(",");return`type: ${e.type}, source: ${e.source}, args: {${t}}`})+"]";return this.tasks=[],e}onFork(e,t,n,r){return this._delegateSpec&&this._delegateSpec.onFork?this._delegateSpec.onFork(e,t,n,r):e.fork(n,r)}onIntercept(e,t,n,r,s){return this._delegateSpec&&this._delegateSpec.onIntercept?this._delegateSpec.onIntercept(e,t,n,r,s):e.intercept(n,r,s)}onInvoke(e,t,n,r,s,i,o){return this.tryTriggerHasTask(e,t,n),this._delegateSpec&&this._delegateSpec.onInvoke?this._delegateSpec.onInvoke(e,t,n,r,s,i,o):e.invoke(n,r,s,i,o)}onHandleError(e,t,n,r){return this._delegateSpec&&this._delegateSpec.onHandleError?this._delegateSpec.onHandleError(e,t,n,r):e.handleError(n,r)}onScheduleTask(e,t,n,r){return"eventTask"!==r.type&&this.tasks.push(r),this._delegateSpec&&this._delegateSpec.onScheduleTask?this._delegateSpec.onScheduleTask(e,t,n,r):e.scheduleTask(n,r)}onInvokeTask(e,t,n,r,s,i){return"eventTask"!==r.type&&this.removeFromTasks(r),this.tryTriggerHasTask(e,t,n),this._delegateSpec&&this._delegateSpec.onInvokeTask?this._delegateSpec.onInvokeTask(e,t,n,r,s,i):e.invokeTask(n,r,s,i)}onCancelTask(e,t,n,r){return"eventTask"!==r.type&&this.removeFromTasks(r),this.tryTriggerHasTask(e,t,n),this._delegateSpec&&this._delegateSpec.onCancelTask?this._delegateSpec.onCancelTask(e,t,n,r):e.cancelTask(n,r)}onHasTask(e,t,n,r){this.lastTaskState=r,this._delegateSpec&&this._delegateSpec.onHasTask?this._delegateSpec.onHasTask(e,t,n,r):e.hasTask(n,r)}}Zone.ProxyZoneSpec=ProxyZoneSpec;
22/**
23 * @license
24 * Copyright Google LLC All Rights Reserved.
25 *
26 * Use of this source code is governed by an MIT-style license that can be
27 * found in the LICENSE file at https://angular.io/license
28 */
29class SyncTestZoneSpec{constructor(e){this.runZone=Zone.current,this.name="syncTestZone for "+e}onScheduleTask(e,t,n,r){switch(r.type){case"microTask":case"macroTask":throw new Error(`Cannot call ${r.source} from within a sync test.`);case"eventTask":r=e.scheduleTask(n,r)}return r}}Zone.SyncTestZoneSpec=SyncTestZoneSpec,
30/**
31 * @license
32 * Copyright Google LLC All Rights Reserved.
33 *
34 * Use of this source code is governed by an MIT-style license that can be
35 * found in the LICENSE file at https://angular.io/license
36 */
37Zone.__load_patch("jasmine",(e,t,n)=>{if(!t)throw new Error("Missing: zone.js");if("undefined"!=typeof jest)return;if("undefined"==typeof jasmine||jasmine.__zone_patch__)return;jasmine.__zone_patch__=!0;const r=t.SyncTestZoneSpec,s=t.ProxyZoneSpec;if(!r)throw new Error("Missing: SyncTestZoneSpec");if(!s)throw new Error("Missing: ProxyZoneSpec");const i=t.current,o=i.fork(new r("jasmine.describe")),c=t.__symbol__,a=!0===e[c("fakeAsyncDisablePatchingClock")],u=!a&&(!0===e[c("fakeAsyncPatchLock")]||!0===e[c("fakeAsyncAutoFakeAsyncWhenClockPatched")]);if(!0!==e[c("ignoreUnhandledRejection")]){const e=jasmine.GlobalErrors;e&&!jasmine[c("GlobalErrors")]&&(jasmine[c("GlobalErrors")]=e,jasmine.GlobalErrors=function(){const t=new e,n=t.install;return n&&!t[c("install")]&&(t[c("install")]=n,t.install=function(){const e=process.listeners("unhandledRejection"),t=n.apply(this,arguments);return process.removeAllListeners("unhandledRejection"),e&&e.forEach(e=>process.on("unhandledRejection",e)),t}),t})}const l=jasmine.getEnv();if(["describe","xdescribe","fdescribe"].forEach(e=>{let t=l[e];l[e]=function(e,n){return t.call(this,e,function r(e){return function(){return o.run(e,this,arguments)}}(n))}}),["it","xit","fit"].forEach(e=>{let t=l[e];l[c(e)]=t,l[e]=function(e,n,r){return arguments[1]=d(n),t.apply(this,arguments)}}),["beforeEach","afterEach","beforeAll","afterAll"].forEach(e=>{let t=l[e];l[c(e)]=t,l[e]=function(e,n){return arguments[0]=d(e),t.apply(this,arguments)}}),!a){const e=jasmine[c("clock")]=jasmine.clock;jasmine.clock=function(){const n=e.apply(this,arguments);if(!n[c("patched")]){n[c("patched")]=c("patched");const e=n[c("tick")]=n.tick;n.tick=function(){const n=t.current.get("FakeAsyncTestZoneSpec");return n?n.tick.apply(n,arguments):e.apply(this,arguments)};const r=n[c("mockDate")]=n.mockDate;n.mockDate=function(){const e=t.current.get("FakeAsyncTestZoneSpec");if(e){const t=arguments.length>0?arguments[0]:new Date;return e.setFakeBaseSystemTime.apply(e,t&&"function"==typeof t.getTime?[t.getTime()]:arguments)}return r.apply(this,arguments)},u&&["install","uninstall"].forEach(e=>{const r=n[c(e)]=n[e];n[e]=function(){const n=t.FakeAsyncTestZoneSpec;if(!n)return r.apply(this,arguments);jasmine[c("clockInstalled")]="install"===e}})}return n}}if(!jasmine[t.__symbol__("createSpyObj")]){const e=jasmine.createSpyObj;jasmine[t.__symbol__("createSpyObj")]=e,jasmine.createSpyObj=function(){const t=Array.prototype.slice.call(arguments),n=t.length>=3?t[2]:null;let r;if(n){const n=Object.defineProperty;Object.defineProperty=function(e,t,r){return n.call(this,e,t,Object.assign(Object.assign({},r),{configurable:!0,enumerable:!0}))};try{r=e.apply(this,t)}finally{Object.defineProperty=n}}else r=e.apply(this,t);return r}}function h(e,n,r,s){const i=!!jasmine[c("clockInstalled")],o=r.testProxyZone;if(i&&u){const n=t[t.__symbol__("fakeAsyncTest")];n&&"function"==typeof n.fakeAsync&&(e=n.fakeAsync(e))}return s?o.run(e,n,[s]):o.run(e,n)}function d(e){return e&&(e.length?function(t){return h(e,this,this.queueRunner,t)}:function(){return h(e,this,this.queueRunner)})}const p=jasmine.QueueRunner;jasmine.QueueRunner=function(n){function r(r){r.onComplete&&(r.onComplete=(e=>()=>{this.testProxyZone=null,this.testProxyZoneSpec=null,i.scheduleMicroTask("jasmine.onComplete",e)})(r.onComplete));const s=e[t.__symbol__("setTimeout")],o=e[t.__symbol__("clearTimeout")];s&&(r.timeout={setTimeout:s||e.setTimeout,clearTimeout:o||e.clearTimeout}),jasmine.UserContext?(r.userContext||(r.userContext=new jasmine.UserContext),r.userContext.queueRunner=this):(r.userContext||(r.userContext={}),r.userContext.queueRunner=this);const c=r.onException;r.onException=function(e){if(e&&"Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL."===e.message){const t=this&&this.testProxyZoneSpec;if(t){const n=t.getAndClearPendingTasksInfo();try{e.message+=n}catch(e){}}}c&&c.call(this,e)},n.call(this,r)}return function(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);function n(){this.constructor=e}e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(r,n),r.prototype.execute=function(){let e=t.current,r=!1;for(;e;){if(e===i){r=!0;break}e=e.parent}if(!r)throw new Error("Unexpected Zone: "+t.current.name);this.testProxyZoneSpec=new s,this.testProxyZone=i.fork(this.testProxyZoneSpec),t.currentTask?n.prototype.execute.call(this):t.current.scheduleMicroTask("jasmine.execute().forceTask",()=>p.prototype.execute.call(this))},r}(p)}),
38/**
39 * @license
40 * Copyright Google LLC All Rights Reserved.
41 *
42 * Use of this source code is governed by an MIT-style license that can be
43 * found in the LICENSE file at https://angular.io/license
44 */
45Zone.__load_patch("jest",(e,t,n)=>{if("undefined"==typeof jest||jest.__zone_patch__)return;jest.__zone_patch__=!0;const r=t.ProxyZoneSpec,s=t.SyncTestZoneSpec;if(!r)throw new Error("Missing ProxyZoneSpec");const i=t.current,o=i.fork(new s("jest.describe")),c=new r,a=i.fork(c);function u(e){return function(...t){return o.run(e,this,t)}}function l(e,r=!1){if("function"!=typeof e)return e;const s=function(){if(!0===t[n.symbol("useFakeTimersCalled")]&&e&&!e.isFakeAsync){const n=t[t.__symbol__("fakeAsyncTest")];n&&"function"==typeof n.fakeAsync&&(e=n.fakeAsync(e))}return c.isTestFunc=r,a.run(e,null,arguments)};return Object.defineProperty(s,"length",{configurable:!0,writable:!0,enumerable:!1}),s.length=e.length,s}["describe","xdescribe","fdescribe"].forEach(n=>{let r=e[n];e[t.__symbol__(n)]||(e[t.__symbol__(n)]=r,e[n]=function(...e){return e[1]=u(e[1]),r.apply(this,e)},e[n].each=function s(e){return function(...t){const n=e.apply(this,t);return function(...e){return e[1]=u(e[1]),n.apply(this,e)}}}(r.each))}),e.describe.only=e.fdescribe,e.describe.skip=e.xdescribe,["it","xit","fit","test","xtest"].forEach(n=>{let r=e[n];e[t.__symbol__(n)]||(e[t.__symbol__(n)]=r,e[n]=function(...e){return e[1]=l(e[1],!0),r.apply(this,e)},e[n].each=function s(e){return function(...t){return function(...n){return n[1]=l(n[1]),e.apply(this,t).apply(this,n)}}}(r.each),e[n].todo=r.todo)}),e.it.only=e.fit,e.it.skip=e.xit,e.test.only=e.fit,e.test.skip=e.xit,["beforeEach","afterEach","beforeAll","afterAll"].forEach(n=>{let r=e[n];e[t.__symbol__(n)]||(e[t.__symbol__(n)]=r,e[n]=function(...e){return e[0]=l(e[0]),r.apply(this,e)})}),t.patchJestObject=function e(r,s=!1){function i(){return!!t.current.get("FakeAsyncTestZoneSpec")}function o(){const e=t.current.get("ProxyZoneSpec");return e&&e.isTestFunc}r[n.symbol("fakeTimers")]||(r[n.symbol("fakeTimers")]=!0,n.patchMethod(r,"_checkFakeTimers",e=>function(t,n){return!!i()||e.apply(t,n)}),n.patchMethod(r,"useFakeTimers",e=>function(r,i){return t[n.symbol("useFakeTimersCalled")]=!0,s||o()?e.apply(r,i):r}),n.patchMethod(r,"useRealTimers",e=>function(r,i){return t[n.symbol("useFakeTimersCalled")]=!1,s||o()?e.apply(r,i):r}),n.patchMethod(r,"setSystemTime",e=>function(n,r){const s=t.current.get("FakeAsyncTestZoneSpec");if(!s||!i())return e.apply(n,r);s.setFakeBaseSystemTime(r[0])}),n.patchMethod(r,"getRealSystemTime",e=>function(n,r){const s=t.current.get("FakeAsyncTestZoneSpec");return s&&i()?s.getRealSystemTime():e.apply(n,r)}),n.patchMethod(r,"runAllTicks",e=>function(n,r){const s=t.current.get("FakeAsyncTestZoneSpec");if(!s)return e.apply(n,r);s.flushMicrotasks()}),n.patchMethod(r,"runAllTimers",e=>function(n,r){const s=t.current.get("FakeAsyncTestZoneSpec");if(!s)return e.apply(n,r);s.flush(100,!0)}),n.patchMethod(r,"advanceTimersByTime",e=>function(n,r){const s=t.current.get("FakeAsyncTestZoneSpec");if(!s)return e.apply(n,r);s.tick(r[0])}),n.patchMethod(r,"runOnlyPendingTimers",e=>function(n,r){const s=t.current.get("FakeAsyncTestZoneSpec");if(!s)return e.apply(n,r);s.flushOnlyPendingTimers()}),n.patchMethod(r,"advanceTimersToNextTimer",e=>function(n,r){const s=t.current.get("FakeAsyncTestZoneSpec");if(!s)return e.apply(n,r);s.tickToNext(r[0])}),n.patchMethod(r,"clearAllTimers",e=>function(n,r){const s=t.current.get("FakeAsyncTestZoneSpec");if(!s)return e.apply(n,r);s.removeAllTimers()}),n.patchMethod(r,"getTimerCount",e=>function(n,r){const s=t.current.get("FakeAsyncTestZoneSpec");return s?s.getTimerCount():e.apply(n,r)}))}}),
46/**
47 * @license
48 * Copyright Google LLC All Rights Reserved.
49 *
50 * Use of this source code is governed by an MIT-style license that can be
51 * found in the LICENSE file at https://angular.io/license
52 */
53Zone.__load_patch("mocha",(e,t)=>{const n=e.Mocha;if(void 0===n)return;if(void 0===t)throw new Error("Missing Zone.js");const r=t.ProxyZoneSpec,s=t.SyncTestZoneSpec;if(!r)throw new Error("Missing ProxyZoneSpec");if(n.__zone_patch__)throw new Error('"Mocha" has already been patched with "Zone".');n.__zone_patch__=!0;const i=t.current,o=i.fork(new s("Mocha.describe"));let c=null;const a=i.fork(new r),u={after:n.after,afterEach:n.afterEach,before:n.before,beforeEach:n.beforeEach,describe:n.describe,it:n.it};function l(e,t,n){for(let r=0;r<e.length;r++){let s=e[r];"function"==typeof s&&(e[r]=0===s.length?t(s):n(s),e[r].toString=function(){return s.toString()})}return e}function h(e){return l(e,(function(e){return function(){return o.run(e,this,arguments)}}))}function d(e){return l(e,(function(e){return function(){return c.run(e,this)}}),(function(e){return function(t){return c.run(e,this,[t])}}))}function p(e){return l(e,(function(e){return function(){return a.run(e,this)}}),(function(e){return function(t){return a.run(e,this,[t])}}))}var T,f;e.describe=e.suite=n.describe=function(){return u.describe.apply(this,h(arguments))},e.xdescribe=e.suite.skip=n.describe.skip=function(){return u.describe.skip.apply(this,h(arguments))},e.describe.only=e.suite.only=n.describe.only=function(){return u.describe.only.apply(this,h(arguments))},e.it=e.specify=e.test=n.it=function(){return u.it.apply(this,d(arguments))},e.xit=e.xspecify=n.it.skip=function(){return u.it.skip.apply(this,d(arguments))},e.it.only=e.test.only=n.it.only=function(){return u.it.only.apply(this,d(arguments))},e.after=e.suiteTeardown=n.after=function(){return u.after.apply(this,p(arguments))},e.afterEach=e.teardown=n.afterEach=function(){return u.afterEach.apply(this,d(arguments))},e.before=e.suiteSetup=n.before=function(){return u.before.apply(this,p(arguments))},e.beforeEach=e.setup=n.beforeEach=function(){return u.beforeEach.apply(this,d(arguments))},T=n.Runner.prototype.runTest,f=n.Runner.prototype.run,n.Runner.prototype.runTest=function(e){t.current.scheduleMicroTask("mocha.forceTask",()=>{T.call(this,e)})},n.Runner.prototype.run=function(e){return this.on("test",e=>{c=i.fork(new r)}),this.on("fail",(e,t)=>{const n=c&&c.get("ProxyZoneSpec");if(n&&t)try{t.message+=n.getAndClearPendingTasksInfo()}catch(e){}}),f.call(this,e)}}),
54/**
55 * @license
56 * Copyright Google LLC All Rights Reserved.
57 *
58 * Use of this source code is governed by an MIT-style license that can be
59 * found in the LICENSE file at https://angular.io/license
60 */
61function(e){class t{constructor(t,n,r){this.finishCallback=t,this.failCallback=n,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 "+r,this.properties={AsyncTestZoneSpec:this},this.supportWaitUnresolvedChainedPromise=!0===e[Zone.__symbol__("supportWaitUnResolvedChainedPromise")]}isUnresolvedChainedPromisePending(){return this.unresolvedChainedPromiseCount>0}_finishCallbackIfDone(){this._pendingMicroTasks||this._pendingMacroTasks||this.supportWaitUnresolvedChainedPromise&&this.isUnresolvedChainedPromisePending()||this.runZone.run(()=>{setTimeout(()=>{this._alreadyErrored||this._pendingMicroTasks||this._pendingMacroTasks||this.finishCallback()},0)})}patchPromiseForTest(){if(!this.supportWaitUnresolvedChainedPromise)return;const e=Promise[Zone.__symbol__("patchPromiseForTest")];e&&e()}unPatchPromiseForTest(){if(!this.supportWaitUnresolvedChainedPromise)return;const e=Promise[Zone.__symbol__("unPatchPromiseForTest")];e&&e()}onScheduleTask(e,n,r,s){return"eventTask"!==s.type&&(this._isSync=!1),"microTask"===s.type&&s.data&&s.data instanceof Promise&&!0===s.data[t.symbolParentUnresolved]&&this.unresolvedChainedPromiseCount--,e.scheduleTask(r,s)}onInvokeTask(e,t,n,r,s,i){return"eventTask"!==r.type&&(this._isSync=!1),e.invokeTask(n,r,s,i)}onCancelTask(e,t,n,r){return"eventTask"!==r.type&&(this._isSync=!1),e.cancelTask(n,r)}onInvoke(e,t,n,r,s,i,o){try{return this._isSync=!0,e.invoke(n,r,s,i,o)}finally{this._isSync&&this._finishCallbackIfDone()}}onHandleError(e,t,n,r){return e.handleError(n,r)&&(this.failCallback(r),this._alreadyErrored=!0),!1}onHasTask(e,t,n,r){e.hasTask(n,r),"microTask"==r.change?(this._pendingMicroTasks=r.microTask,this._finishCallbackIfDone()):"macroTask"==r.change&&(this._pendingMacroTasks=r.macroTask,this._finishCallbackIfDone())}}t.symbolParentUnresolved=Zone.__symbol__("parentUnresolved"),Zone.AsyncTestZoneSpec=t}("undefined"!=typeof window&&window||"undefined"!=typeof self&&self||global),Zone.__load_patch("asynctest",(e,t,n)=>{function r(e,n,r,s){const i=t.current,o=t.AsyncTestZoneSpec;if(void 0===o)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");const c=t.ProxyZoneSpec;if(!c)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");const a=c.get();c.assertPresent();const u=t.current.getZoneWith("ProxyZoneSpec"),l=a.getDelegate();return u.parent.run(()=>{const e=new o(()=>{a.getDelegate()==e&&a.setDelegate(l),e.unPatchPromiseForTest(),i.run(()=>{r()})},t=>{a.getDelegate()==e&&a.setDelegate(l),e.unPatchPromiseForTest(),i.run(()=>{s(t)})},"test");a.setDelegate(e),e.patchPromiseForTest()}),t.current.runGuarded(e,n)}t[n.symbol("asyncTest")]=function t(n){return e.jasmine?function(e){e||((e=function(){}).fail=function(e){throw e}),r(n,this,e,t=>{if("string"==typeof t)return e.fail(new Error(t));e.fail(t)})}:function(){return new Promise((e,t)=>{r(n,this,e,t)})}}}),
62/**
63 * @license
64 * Copyright Google LLC All Rights Reserved.
65 *
66 * Use of this source code is governed by an MIT-style license that can be
67 * found in the LICENSE file at https://angular.io/license
68 */
69function(e){const t=e.Date;function n(){if(0===arguments.length){const e=new t;return e.setTime(n.now()),e}{const e=Array.prototype.slice.call(arguments);return new t(...e)}}n.now=function(){const e=Zone.current.get("FakeAsyncTestZoneSpec");return e?e.getFakeSystemTime():t.now.apply(this,arguments)},n.UTC=t.UTC,n.parse=t.parse;const r={setTimeout:e.setTimeout,setInterval:e.setInterval,clearTimeout:e.clearTimeout,clearInterval:e.clearInterval};class s{constructor(){this._schedulerQueue=[],this._currentTickTime=0,this._currentFakeBaseSystemTime=t.now(),this._currentTickRequeuePeriodicEntries=[]}getCurrentTickTime(){return this._currentTickTime}getFakeSystemTime(){return this._currentFakeBaseSystemTime+this._currentTickTime}setFakeBaseSystemTime(e){this._currentFakeBaseSystemTime=e}getRealSystemTime(){return t.now()}scheduleFunction(e,t,n){let r=(n=Object.assign({args:[],isPeriodic:!1,isRequestAnimationFrame:!1,id:-1,isRequeuePeriodic:!1},n)).id<0?s.nextId++:n.id,i={endTime:this._currentTickTime+t,id:r,func:e,args:n.args,delay:t,isPeriodic:n.isPeriodic,isRequestAnimationFrame:n.isRequestAnimationFrame};n.isRequeuePeriodic&&this._currentTickRequeuePeriodicEntries.push(i);let o=0;for(;o<this._schedulerQueue.length&&!(i.endTime<this._schedulerQueue[o].endTime);o++);return this._schedulerQueue.splice(o,0,i),r}removeScheduledFunctionWithId(e){for(let t=0;t<this._schedulerQueue.length;t++)if(this._schedulerQueue[t].id==e){this._schedulerQueue.splice(t,1);break}}removeAll(){this._schedulerQueue=[]}getTimerCount(){return this._schedulerQueue.length}tickToNext(e=1,t,n){this._schedulerQueue.length<e||this.tick(this._schedulerQueue[e-1].endTime-this._currentTickTime,t,n)}tick(t=0,n,r){let s=this._currentTickTime+t,i=0;const o=(r=Object.assign({processNewMacroTasksSynchronously:!0},r)).processNewMacroTasksSynchronously?this._schedulerQueue:this._schedulerQueue.slice();if(0===o.length&&n)n(t);else{for(;o.length>0&&(this._currentTickRequeuePeriodicEntries=[],!(s<o[0].endTime));){let t=o.shift();if(!r.processNewMacroTasksSynchronously){const e=this._schedulerQueue.indexOf(t);e>=0&&this._schedulerQueue.splice(e,1)}if(i=this._currentTickTime,this._currentTickTime=t.endTime,n&&n(this._currentTickTime-i),!t.func.apply(e,t.isRequestAnimationFrame?[this._currentTickTime]:t.args))break;r.processNewMacroTasksSynchronously||this._currentTickRequeuePeriodicEntries.forEach(e=>{let t=0;for(;t<o.length&&!(e.endTime<o[t].endTime);t++);o.splice(t,0,e)})}i=this._currentTickTime,this._currentTickTime=s,n&&n(this._currentTickTime-i)}}flushOnlyPendingTimers(e){if(0===this._schedulerQueue.length)return 0;const t=this._currentTickTime;return this.tick(this._schedulerQueue[this._schedulerQueue.length-1].endTime-t,e,{processNewMacroTasksSynchronously:!1}),this._currentTickTime-t}flush(e=20,t=!1,n){return t?this.flushPeriodic(n):this.flushNonPeriodic(e,n)}flushPeriodic(e){if(0===this._schedulerQueue.length)return 0;const t=this._currentTickTime;return this.tick(this._schedulerQueue[this._schedulerQueue.length-1].endTime-t,e),this._currentTickTime-t}flushNonPeriodic(t,n){const r=this._currentTickTime;let s=0,i=0;for(;this._schedulerQueue.length>0;){if(i++,i>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(e=>!e.isPeriodic&&!e.isRequestAnimationFrame).length)break;const r=this._schedulerQueue.shift();if(s=this._currentTickTime,this._currentTickTime=r.endTime,n&&n(this._currentTickTime-s),!r.func.apply(e,r.args))break}return this._currentTickTime-r}}s.nextId=1;class i{constructor(t,n=!1,r){this.trackPendingRequestAnimationFrame=n,this.macroTaskOptions=r,this._scheduler=new s,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")])}static assertInZone(){if(null==Zone.current.get("FakeAsyncTestZoneSpec"))throw new Error("The code should be running in the fakeAsync zone to call this function")}_fnAndFlush(t,n){return(...r)=>(t.apply(e,r),null===this._lastError?(null!=n.onSuccess&&n.onSuccess.apply(e),this.flushMicrotasks()):null!=n.onError&&n.onError.apply(e),null===this._lastError)}static _removeTimer(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}_dequeueTimer(e){return()=>{i._removeTimer(this.pendingTimers,e)}}_requeuePeriodicTimer(e,t,n,r){return()=>{-1!==this.pendingPeriodicTimers.indexOf(r)&&this._scheduler.scheduleFunction(e,t,{args:n,isPeriodic:!0,id:r,isRequeuePeriodic:!0})}}_dequeuePeriodicTimer(e){return()=>{i._removeTimer(this.pendingPeriodicTimers,e)}}_setTimeout(e,t,n,r=!0){let i=this._dequeueTimer(s.nextId),o=this._fnAndFlush(e,{onSuccess:i,onError:i}),c=this._scheduler.scheduleFunction(o,t,{args:n,isRequestAnimationFrame:!r});return r&&this.pendingTimers.push(c),c}_clearTimeout(e){i._removeTimer(this.pendingTimers,e),this._scheduler.removeScheduledFunctionWithId(e)}_setInterval(e,t,n){let r=s.nextId,i={onSuccess:null,onError:this._dequeuePeriodicTimer(r)},o=this._fnAndFlush(e,i);return i.onSuccess=this._requeuePeriodicTimer(o,t,n,r),this._scheduler.scheduleFunction(o,t,{args:n,isPeriodic:!0}),this.pendingPeriodicTimers.push(r),r}_clearInterval(e){i._removeTimer(this.pendingPeriodicTimers,e),this._scheduler.removeScheduledFunctionWithId(e)}_resetLastErrorAndThrow(){let e=this._lastError||this._uncaughtPromiseErrors[0];throw this._uncaughtPromiseErrors.length=0,this._lastError=null,e}getCurrentTickTime(){return this._scheduler.getCurrentTickTime()}getFakeSystemTime(){return this._scheduler.getFakeSystemTime()}setFakeBaseSystemTime(e){this._scheduler.setFakeBaseSystemTime(e)}getRealSystemTime(){return this._scheduler.getRealSystemTime()}static patchDate(){e[Zone.__symbol__("disableDatePatching")]||e.Date!==n&&(e.Date=n,n.prototype=t.prototype,i.checkTimerPatch())}static resetDate(){e.Date===n&&(e.Date=t)}static checkTimerPatch(){e.setTimeout!==r.setTimeout&&(e.setTimeout=r.setTimeout,e.clearTimeout=r.clearTimeout),e.setInterval!==r.setInterval&&(e.setInterval=r.setInterval,e.clearInterval=r.clearInterval)}lockDatePatch(){this.patchDateLocked=!0,i.patchDate()}unlockDatePatch(){this.patchDateLocked=!1,i.resetDate()}tickToNext(e=1,t,n={processNewMacroTasksSynchronously:!0}){e<=0||(i.assertInZone(),this.flushMicrotasks(),this._scheduler.tickToNext(e,t,n),null!==this._lastError&&this._resetLastErrorAndThrow())}tick(e=0,t,n={processNewMacroTasksSynchronously:!0}){i.assertInZone(),this.flushMicrotasks(),this._scheduler.tick(e,t,n),null!==this._lastError&&this._resetLastErrorAndThrow()}flushMicrotasks(){for(i.assertInZone();this._microtasks.length>0;){let e=this._microtasks.shift();e.func.apply(e.target,e.args)}(()=>{(null!==this._lastError||this._uncaughtPromiseErrors.length)&&this._resetLastErrorAndThrow()})()}flush(e,t,n){i.assertInZone(),this.flushMicrotasks();const r=this._scheduler.flush(e,t,n);return null!==this._lastError&&this._resetLastErrorAndThrow(),r}flushOnlyPendingTimers(e){i.assertInZone(),this.flushMicrotasks();const t=this._scheduler.flushOnlyPendingTimers(e);return null!==this._lastError&&this._resetLastErrorAndThrow(),t}removeAllTimers(){i.assertInZone(),this._scheduler.removeAll(),this.pendingPeriodicTimers=[],this.pendingTimers=[]}getTimerCount(){return this._scheduler.getTimerCount()+this._microtasks.length}onScheduleTask(e,t,n,r){switch(r.type){case"microTask":let t,s=r.data&&r.data.args;if(s){let e=r.data.cbIdx;"number"==typeof s.length&&s.length>e+1&&(t=Array.prototype.slice.call(s,e+1))}this._microtasks.push({func:r.invoke,args:t,target:r.data&&r.data.target});break;case"macroTask":switch(r.source){case"setTimeout":r.data.handleId=this._setTimeout(r.invoke,r.data.delay,Array.prototype.slice.call(r.data.args,2));break;case"setImmediate":r.data.handleId=this._setTimeout(r.invoke,0,Array.prototype.slice.call(r.data.args,1));break;case"setInterval":r.data.handleId=this._setInterval(r.invoke,r.data.delay,Array.prototype.slice.call(r.data.args,2));break;case"XMLHttpRequest.send":throw new Error("Cannot make XHRs from within a fake async test. Request URL: "+r.data.url);case"requestAnimationFrame":case"webkitRequestAnimationFrame":case"mozRequestAnimationFrame":r.data.handleId=this._setTimeout(r.invoke,16,r.data.args,this.trackPendingRequestAnimationFrame);break;default:const e=this.findMacroTaskOption(r);if(e){const t=r.data&&r.data.args,n=t&&t.length>1?t[1]:0;let s=e.callbackArgs?e.callbackArgs:t;e.isPeriodic?(r.data.handleId=this._setInterval(r.invoke,n,s),r.data.isPeriodic=!0):r.data.handleId=this._setTimeout(r.invoke,n,s);break}throw new Error("Unknown macroTask scheduled in fake async test: "+r.source)}break;case"eventTask":r=e.scheduleTask(n,r)}return r}onCancelTask(e,t,n,r){switch(r.source){case"setTimeout":case"requestAnimationFrame":case"webkitRequestAnimationFrame":case"mozRequestAnimationFrame":return this._clearTimeout(r.data.handleId);case"setInterval":return this._clearInterval(r.data.handleId);default:const t=this.findMacroTaskOption(r);if(t){const e=r.data.handleId;return t.isPeriodic?this._clearInterval(e):this._clearTimeout(e)}return e.cancelTask(n,r)}}onInvoke(e,t,n,r,s,o,c){try{return i.patchDate(),e.invoke(n,r,s,o,c)}finally{this.patchDateLocked||i.resetDate()}}findMacroTaskOption(e){if(!this.macroTaskOptions)return null;for(let t=0;t<this.macroTaskOptions.length;t++){const n=this.macroTaskOptions[t];if(n.source===e.source)return n}return null}onHandleError(e,t,n,r){return this._lastError=r,!1}}Zone.FakeAsyncTestZoneSpec=i}("object"==typeof window&&window||"object"==typeof self&&self||global),Zone.__load_patch("fakeasync",(e,t,n)=>{const r=t&&t.FakeAsyncTestZoneSpec;function s(){return t&&t.ProxyZoneSpec}let i=null;function o(){i&&i.unlockDatePatch(),i=null,s()&&s().assertPresent().resetDelegate()}function c(){if(null==i&&(i=t.current.get("FakeAsyncTestZoneSpec"),null==i))throw new Error("The code should be running in the fakeAsync zone to call this function");return i}function a(){c().flushMicrotasks()}t[n.symbol("fakeAsyncTest")]={resetFakeAsyncZone:o,flushMicrotasks:a,discardPeriodicTasks:function u(){c().pendingPeriodicTimers.length=0},tick:function l(e=0,t=!1){c().tick(e,null,t)},flush:function h(e){return c().flush(e)},fakeAsync:function d(e){const n=function(...n){const c=s();if(!c)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");const u=c.assertPresent();if(t.current.get("FakeAsyncTestZoneSpec"))throw new Error("fakeAsync() calls can not be nested");try{if(!i){if(u.getDelegate()instanceof r)throw new Error("fakeAsync() calls can not be nested");i=new r}let t;const s=u.getDelegate();u.setDelegate(i),i.lockDatePatch();try{t=e.apply(this,n),a()}finally{u.setDelegate(s)}if(i.pendingPeriodicTimers.length>0)throw new Error(`${i.pendingPeriodicTimers.length} `+"periodic timer(s) still in the queue.");if(i.pendingTimers.length>0)throw new Error(`${i.pendingTimers.length} timer(s) still in the queue.`);return t}finally{o()}};return n.isFakeAsync=!0,n}}},!0),
70/**
71 * @license
72 * Copyright Google LLC All Rights Reserved.
73 *
74 * Use of this source code is governed by an MIT-style license that can be
75 * found in the LICENSE file at https://angular.io/license
76 */
77Zone.__load_patch("promisefortest",(e,t,n)=>{const r=n.symbol("state"),s=n.symbol("parentUnresolved");Promise[n.symbol("patchPromiseForTest")]=function e(){let n=Promise[t.__symbol__("ZonePromiseThen")];n||(n=Promise[t.__symbol__("ZonePromiseThen")]=Promise.prototype.then,Promise.prototype.then=function(){const e=n.apply(this,arguments);if(null===this[r]){const n=t.current.get("AsyncTestZoneSpec");n&&(n.unresolvedChainedPromiseCount++,e[s]=!0)}return e})},Promise[n.symbol("unPatchPromiseForTest")]=function e(){const n=Promise[t.__symbol__("ZonePromiseThen")];n&&(Promise.prototype.then=n,Promise[t.__symbol__("ZonePromiseThen")]=void 0)}});
Note: See TracBrowser for help on using the repository browser.