blob: 69447dbae5d6f21f9bc7ec0bf6d15b3f945c8f16 [file] [log] [blame]
/**
* @license Angular v8.1.1
* (c) 2010-2019 Google LLC. https://angular.io/
* License: MIT
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("rxjs")):"function"==typeof define&&define.amd?define("@angular/common/testing",["exports","@angular/core","@angular/common","rxjs"],e):e(((t=t||self).ng=t.ng||{},t.ng.common=t.ng.common||{},t.ng.common.testing={}),t.ng.core,t.ng.common,t.rxjs)}(this,function(t,e,n,r){"use strict";var s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},o=function(){return(o=Object.assign||function t(e){for(var n,r=1,s=arguments.length;r<s;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function h(t,e,n,r){var s,o=arguments.length,h=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,n,r);else for(var i=t.length-1;i>=0;i--)(s=t[i])&&(h=(o<3?s(h):o>3?s(e,n,h):s(e,n))||h);return o>3&&h&&Object.defineProperty(e,n,h),h}function i(t,e){return function(n,r){e(n,r,t)}}function a(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/var p=function(){function t(){this.urlChanges=[],this._history=[new u("","",null)],this._historyIndex=0,this._subject=new e.EventEmitter,this._baseHref="",this._platformStrategy=null,this._platformLocation=null,this._urlChangeListeners=[]}return t.prototype.setInitialPath=function(t){this._history[this._historyIndex].path=t},t.prototype.setBaseHref=function(t){this._baseHref=t},t.prototype.path=function(){return this._history[this._historyIndex].path},t.prototype.getState=function(){return this._history[this._historyIndex].state},t.prototype.isCurrentPathEqualTo=function(t,e){void 0===e&&(e="");var n=t.endsWith("/")?t.substring(0,t.length-1):t;return(this.path().endsWith("/")?this.path().substring(0,this.path().length-1):this.path())==n+(e.length>0?"?"+e:"")},t.prototype.simulateUrlPop=function(t){this._subject.emit({url:t,pop:!0,type:"popstate"})},t.prototype.simulateHashChange=function(t){this.setInitialPath(t),this.urlChanges.push("hash: "+t),this._subject.emit({url:t,pop:!0,type:"hashchange"})},t.prototype.prepareExternalUrl=function(t){return t.length>0&&!t.startsWith("/")&&(t="/"+t),this._baseHref+t},t.prototype.go=function(t,e,n){void 0===e&&(e=""),void 0===n&&(n=null),t=this.prepareExternalUrl(t),this._historyIndex>0&&this._history.splice(this._historyIndex+1),this._history.push(new u(t,e,n)),this._historyIndex=this._history.length-1;var r=this._history[this._historyIndex-1];if(r.path!=t||r.query!=e){var s=t+(e.length>0?"?"+e:"");this.urlChanges.push(s),this._subject.emit({url:s,pop:!1})}},t.prototype.replaceState=function(t,e,n){void 0===e&&(e=""),void 0===n&&(n=null),t=this.prepareExternalUrl(t);var r=this._history[this._historyIndex];r.path==t&&r.query==e||(r.path=t,r.query=e,r.state=n,this.urlChanges.push("replace: "+t+(e.length>0?"?"+e:"")))},t.prototype.forward=function(){this._historyIndex<this._history.length-1&&(this._historyIndex++,this._subject.emit({url:this.path(),state:this.getState(),pop:!0}))},t.prototype.back=function(){this._historyIndex>0&&(this._historyIndex--,this._subject.emit({url:this.path(),state:this.getState(),pop:!0}))},t.prototype.onUrlChange=function(t){var e=this;this._urlChangeListeners.push(t),this.subscribe(function(t){e._notifyUrlChangeListeners(t.url,t.state)})},t.prototype._notifyUrlChangeListeners=function(t,e){void 0===t&&(t=""),this._urlChangeListeners.forEach(function(n){return n(t,e)})},t.prototype.subscribe=function(t,e,n){return this._subject.subscribe({next:t,error:e,complete:n})},t.prototype.normalize=function(t){return null},h([e.Injectable()],t)}(),u=function u(t,e,n){this.path=t,this.query=e,this.state=n},c=function(t){function n(){var n=t.call(this)||this;return n.internalBaseHref="/",n.internalPath="/",n.internalTitle="",n.urlChanges=[],n._subject=new e.EventEmitter,n.stateChanges=[],n}return function r(t,e){function n(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(n,t),n.prototype.simulatePopState=function(t){this.internalPath=t,this._subject.emit(new l(this.path()))},n.prototype.path=function(t){return void 0===t&&(t=!1),this.internalPath},n.prototype.prepareExternalUrl=function(t){return t.startsWith("/")&&this.internalBaseHref.endsWith("/")?this.internalBaseHref+t.substring(1):this.internalBaseHref+t},n.prototype.pushState=function(t,e,n,r){this.stateChanges.push(t),this.internalTitle=e;var s=n+(r.length>0?"?"+r:"");this.internalPath=s;var o=this.prepareExternalUrl(s);this.urlChanges.push(o)},n.prototype.replaceState=function(t,e,n,r){this.stateChanges[(this.stateChanges.length||1)-1]=t,this.internalTitle=e;var s=n+(r.length>0?"?"+r:"");this.internalPath=s;var o=this.prepareExternalUrl(s);this.urlChanges.push("replace: "+o)},n.prototype.onPopState=function(t){this._subject.subscribe({next:t})},n.prototype.getBaseHref=function(){return this.internalBaseHref},n.prototype.back=function(){this.urlChanges.length>0&&(this.urlChanges.pop(),this.stateChanges.pop(),this.simulatePopState(this.urlChanges.length>0?this.urlChanges[this.urlChanges.length-1]:""))},n.prototype.forward=function(){throw"not implemented"},n.prototype.getState=function(){return this.stateChanges[(this.stateChanges.length||1)-1]},h([e.Injectable(),a("design:paramtypes",[])],n)}(n.LocationStrategy),l=function l(t){this.newUrl=t,this.pop=!0,this.type="popstate"},f=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,g=new e.InjectionToken("MOCK_PLATFORM_LOCATION_CONFIG"),y=function(){function t(t){if(this.baseHref="",this.hashUpdate=new r.Subject,this.urlChanges=[{hostname:"",protocol:"",port:"",pathname:"/",search:"",hash:"",state:null}],t){this.baseHref=t.appBaseHref||"";var e=this.parseChanges(null,t.startUrl||"http://<empty>/",this.baseHref);this.urlChanges[0]=o({},e)}}return Object.defineProperty(t.prototype,"hostname",{get:function(){return this.urlChanges[0].hostname},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"protocol",{get:function(){return this.urlChanges[0].protocol},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"port",{get:function(){return this.urlChanges[0].port},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pathname",{get:function(){return this.urlChanges[0].pathname},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"search",{get:function(){return this.urlChanges[0].search},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hash",{get:function(){return this.urlChanges[0].hash},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this.urlChanges[0].state},enumerable:!0,configurable:!0}),t.prototype.getBaseHrefFromDOM=function(){return this.baseHref},t.prototype.onPopState=function(t){},t.prototype.onHashChange=function(t){this.hashUpdate.subscribe(t)},Object.defineProperty(t.prototype,"href",{get:function(){return this.protocol+"//"+this.hostname+(this.port?":"+this.port:"")+("/"===this.pathname?"":this.pathname)+this.search+this.hash},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"url",{get:function(){return""+this.pathname+this.search+this.hash},enumerable:!0,configurable:!0}),t.prototype.parseChanges=function(t,e,n){return void 0===n&&(n=""),t=JSON.parse(JSON.stringify(t)),o({},function r(t,e){var n,r;/^((http[s]?|ftp):\/\/)/.test(t)||(n="http://empty.com/");try{r=new URL(t,n)}catch(h){var s=f.exec(n||""+t);if(!s)throw new Error("Invalid URL: "+t+" with base: "+e);var o=s[4].split(":");r={protocol:s[1],hostname:o[0],port:o[1]||"",pathname:s[5],search:s[6],hash:s[8]}}return r.pathname&&0===r.pathname.indexOf(e)&&(r.pathname=r.pathname.substring(e.length)),{hostname:!n&&r.hostname||"",protocol:!n&&r.protocol||"",port:!n&&r.port||"",pathname:r.pathname||"/",search:r.search||"",hash:r.hash||""}}(e,n),{state:t})},t.prototype.replaceState=function(t,e,n){var r=this.parseChanges(t,n);this.urlChanges[0]=o({},this.urlChanges[0],{pathname:r.pathname,search:r.search,hash:r.hash,state:r.state})},t.prototype.pushState=function(t,e,n){var r=this.parseChanges(t,n);this.urlChanges.unshift(o({},this.urlChanges[0],{pathname:r.pathname,search:r.search,hash:r.hash,state:r.state}))},t.prototype.forward=function(){throw new Error("Not implemented")},t.prototype.back=function(){var t=this,e=this.url,n=this.hash;this.urlChanges.shift(),n!==this.hash&&function r(t){Promise.resolve(null).then(t)}
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/(function(){return t.hashUpdate.next({type:"hashchange",state:null,oldUrl:e,newUrl:t.url})})},t.prototype.getState=function(){return this.state},h([e.Injectable(),i(0,e.Inject(g)),i(0,e.Optional()),a("design:paramtypes",[Object])],t)}();t.SpyLocation=p,t.MockLocationStrategy=c,t.MOCK_PLATFORM_LOCATION_CONFIG=g,t.MockPlatformLocation=y,Object.defineProperty(t,"__esModule",{value:!0})});