/** * @license Angular v5.2.10 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ !function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/compiler")):"function"==typeof define&&define.amd?define("@angular/compiler/testing",["exports","@angular/compiler"],factory):factory((global.ng=global.ng||{},global.ng.compiler=global.ng.compiler||{},global.ng.compiler.testing={}),global.ng.compiler)}(this,function(exports,_angular_compiler){"use strict";function __extends(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}function remove(list,el){var index=list.indexOf(el);index>-1&&list.splice(index,1)}var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},MockResourceLoader=function(_super){function MockResourceLoader(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this._expectations=[],_this._definitions=new Map,_this._requests=[],_this}return __extends(MockResourceLoader,_super),MockResourceLoader.prototype.get=function(url){var request=new _PendingRequest(url);return this._requests.push(request),request.getPromise()},MockResourceLoader.prototype.hasPendingRequests=function(){return!!this._requests.length},MockResourceLoader.prototype.expect=function(url,response){var expectation=new _Expectation(url,response);this._expectations.push(expectation)},MockResourceLoader.prototype.when=function(url,response){this._definitions.set(url,response)},MockResourceLoader.prototype.flush=function(){if(0===this._requests.length)throw new Error("No pending requests to flush");do{this._processRequest(this._requests.shift())}while(this._requests.length>0);this.verifyNoOutstandingExpectations()},MockResourceLoader.prototype.verifyNoOutstandingExpectations=function(){if(0!==this._expectations.length){for(var urls=[],i=0;i<this._expectations.length;i++){var expectation=this._expectations[i];urls.push(expectation.url)}throw new Error("Unsatisfied requests: "+urls.join(", "))}},MockResourceLoader.prototype._processRequest=function(request){var url=request.url;if(this._expectations.length>0){var expectation=this._expectations[0];if(expectation.url==url)return remove(this._expectations,expectation),void request.complete(expectation.response)}if(this._definitions.has(url)){var response=this._definitions.get(url);return void request.complete(null==response?null:response)}throw new Error("Unexpected request "+url)},MockResourceLoader}(_angular_compiler.ResourceLoader),_PendingRequest=function(){function _PendingRequest(url){var _this=this;this.url=url,this.promise=new Promise(function(res,rej){_this.resolve=res,_this.reject=rej})}return _PendingRequest.prototype.complete=function(response){null==response?this.reject("Failed to load "+this.url):this.resolve(response)},_PendingRequest.prototype.getPromise=function(){return this.promise},_PendingRequest}(),_Expectation=function(){function _Expectation(url,response){this.url=url,this.response=response}return _Expectation}(),MockSchemaRegistry=function(){function MockSchemaRegistry(existingProperties,attrPropMapping,existingElements,invalidProperties,invalidAttributes){this.existingProperties=existingProperties,this.attrPropMapping=attrPropMapping,this.existingElements=existingElements,this.invalidProperties=invalidProperties,this.invalidAttributes=invalidAttributes}return MockSchemaRegistry.prototype.hasProperty=function(tagName,property,schemas){var value=this.existingProperties[property];return void 0===value||value},MockSchemaRegistry.prototype.hasElement=function(tagName,schemaMetas){var value=this.existingElements[tagName.toLowerCase()];return void 0===value||value},MockSchemaRegistry.prototype.allKnownElementNames=function(){return Object.keys(this.existingElements)},MockSchemaRegistry.prototype.securityContext=function(selector,property,isAttribute){return _angular_compiler.core.SecurityContext.NONE},MockSchemaRegistry.prototype.getMappedPropName=function(attrName){return this.attrPropMapping[attrName]||attrName},MockSchemaRegistry.prototype.getDefaultComponentElementName=function(){return"ng-component"},MockSchemaRegistry.prototype.validateProperty=function(name){return this.invalidProperties.indexOf(name)>-1?{error:!0,msg:"Binding to property '"+name+"' is disallowed for security reasons"}:{error:!1}},MockSchemaRegistry.prototype.validateAttribute=function(name){return this.invalidAttributes.indexOf(name)>-1?{error:!0,msg:"Binding to attribute '"+name+"' is disallowed for security reasons"}:{error:!1}},MockSchemaRegistry.prototype.normalizeAnimationStyleProperty=function(propName){return propName},MockSchemaRegistry.prototype.normalizeAnimationStyleValue=function(camelCaseProp,userProvidedProp,val){return{error:null,value:val.toString()}},MockSchemaRegistry}(),MockDirectiveResolver=function(_super){function MockDirectiveResolver(reflector){var _this=_super.call(this,reflector)||this;return _this._directives=new Map,_this}return __extends(MockDirectiveResolver,_super),MockDirectiveResolver.prototype.resolve=function(type,throwIfNotFound){return void 0===throwIfNotFound&&(throwIfNotFound=!0),this._directives.get(type)||_super.prototype.resolve.call(this,type,throwIfNotFound)},MockDirectiveResolver.prototype.setDirective=function(type,metadata){this._directives.set(type,metadata)},MockDirectiveResolver}(_angular_compiler.DirectiveResolver),MockNgModuleResolver=function(_super){function MockNgModuleResolver(reflector){var _this=_super.call(this,reflector)||this;return _this._ngModules=new Map,_this}return __extends(MockNgModuleResolver,_super),MockNgModuleResolver.prototype.setNgModule=function(type,metadata){this._ngModules.set(type,metadata)},MockNgModuleResolver.prototype.resolve=function(type,throwIfNotFound){return void 0===throwIfNotFound&&(throwIfNotFound=!0),this._ngModules.get(type)||_super.prototype.resolve.call(this,type,throwIfNotFound)},MockNgModuleResolver}(_angular_compiler.NgModuleResolver),MockPipeResolver=function(_super){function MockPipeResolver(refector){var _this=_super.call(this,refector)||this;return _this._pipes=new Map,_this}return __extends(MockPipeResolver,_super),MockPipeResolver.prototype.setPipe=function(type,metadata){this._pipes.set(type,metadata)},MockPipeResolver.prototype.resolve=function(type,throwIfNotFound){void 0===throwIfNotFound&&(throwIfNotFound=!0);var metadata=this._pipes.get(type);return metadata||(metadata=_super.prototype.resolve.call(this,type,throwIfNotFound)),metadata},MockPipeResolver}(_angular_compiler.PipeResolver);exports.MockResourceLoader=MockResourceLoader,exports.MockSchemaRegistry=MockSchemaRegistry,exports.MockDirectiveResolver=MockDirectiveResolver,exports.MockNgModuleResolver=MockNgModuleResolver,exports.MockPipeResolver=MockPipeResolver,Object.defineProperty(exports,"__esModule",{value:!0})}); //# sourceMappingURL=compiler-testing.umd.min.js.map