1
|
/**
|
2
|
* @license Angular v4.4.6
|
3
|
* (c) 2010-2017 Google, Inc. https://angular.io/
|
4
|
* License: MIT
|
5
|
*/
|
6
|
(function (global, factory) {
|
7
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/compiler'), require('@angular/core/testing')) :
|
8
|
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/compiler', '@angular/core/testing'], factory) :
|
9
|
(factory((global.ng = global.ng || {}, global.ng.compiler = global.ng.compiler || {}, global.ng.compiler.testing = global.ng.compiler.testing || {}),global.ng.core,global.ng.compiler,global.ng.core.testing));
|
10
|
}(this, (function (exports,_angular_core,_angular_compiler,_angular_core_testing) { 'use strict';
|
11
|
|
12
|
/*! *****************************************************************************
|
13
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
14
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
15
|
this file except in compliance with the License. You may obtain a copy of the
|
16
|
License at http://www.apache.org/licenses/LICENSE-2.0
|
17
|
|
18
|
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
19
|
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
20
|
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
21
|
MERCHANTABLITY OR NON-INFRINGEMENT.
|
22
|
|
23
|
See the Apache Version 2.0 License for specific language governing permissions
|
24
|
and limitations under the License.
|
25
|
***************************************************************************** */
|
26
|
/* global Reflect, Promise */
|
27
|
|
28
|
var extendStatics = Object.setPrototypeOf ||
|
29
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
30
|
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
31
|
|
32
|
function __extends(d, b) {
|
33
|
extendStatics(d, b);
|
34
|
function __() { this.constructor = d; }
|
35
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
36
|
}
|
37
|
|
38
|
/**
|
39
|
* @license Angular v4.4.6
|
40
|
* (c) 2010-2017 Google, Inc. https://angular.io/
|
41
|
* License: MIT
|
42
|
*/
|
43
|
/**
|
44
|
* @license
|
45
|
* Copyright Google Inc. All Rights Reserved.
|
46
|
*
|
47
|
* Use of this source code is governed by an MIT-style license that can be
|
48
|
* found in the LICENSE file at https://angular.io/license
|
49
|
*/
|
50
|
var MockSchemaRegistry = (function () {
|
51
|
function MockSchemaRegistry(existingProperties, attrPropMapping, existingElements, invalidProperties, invalidAttributes) {
|
52
|
this.existingProperties = existingProperties;
|
53
|
this.attrPropMapping = attrPropMapping;
|
54
|
this.existingElements = existingElements;
|
55
|
this.invalidProperties = invalidProperties;
|
56
|
this.invalidAttributes = invalidAttributes;
|
57
|
}
|
58
|
MockSchemaRegistry.prototype.hasProperty = function (tagName, property, schemas) {
|
59
|
var value = this.existingProperties[property];
|
60
|
return value === void 0 ? true : value;
|
61
|
};
|
62
|
MockSchemaRegistry.prototype.hasElement = function (tagName, schemaMetas) {
|
63
|
var value = this.existingElements[tagName.toLowerCase()];
|
64
|
return value === void 0 ? true : value;
|
65
|
};
|
66
|
MockSchemaRegistry.prototype.allKnownElementNames = function () { return Object.keys(this.existingElements); };
|
67
|
MockSchemaRegistry.prototype.securityContext = function (selector, property, isAttribute) {
|
68
|
return _angular_core.SecurityContext.NONE;
|
69
|
};
|
70
|
MockSchemaRegistry.prototype.getMappedPropName = function (attrName) { return this.attrPropMapping[attrName] || attrName; };
|
71
|
MockSchemaRegistry.prototype.getDefaultComponentElementName = function () { return 'ng-component'; };
|
72
|
MockSchemaRegistry.prototype.validateProperty = function (name) {
|
73
|
if (this.invalidProperties.indexOf(name) > -1) {
|
74
|
return { error: true, msg: "Binding to property '" + name + "' is disallowed for security reasons" };
|
75
|
}
|
76
|
else {
|
77
|
return { error: false };
|
78
|
}
|
79
|
};
|
80
|
MockSchemaRegistry.prototype.validateAttribute = function (name) {
|
81
|
if (this.invalidAttributes.indexOf(name) > -1) {
|
82
|
return {
|
83
|
error: true,
|
84
|
msg: "Binding to attribute '" + name + "' is disallowed for security reasons"
|
85
|
};
|
86
|
}
|
87
|
else {
|
88
|
return { error: false };
|
89
|
}
|
90
|
};
|
91
|
MockSchemaRegistry.prototype.normalizeAnimationStyleProperty = function (propName) { return propName; };
|
92
|
MockSchemaRegistry.prototype.normalizeAnimationStyleValue = function (camelCaseProp, userProvidedProp, val) {
|
93
|
return { error: null, value: val.toString() };
|
94
|
};
|
95
|
return MockSchemaRegistry;
|
96
|
}());
|
97
|
/**
|
98
|
* @license
|
99
|
* Copyright Google Inc. All Rights Reserved.
|
100
|
*
|
101
|
* Use of this source code is governed by an MIT-style license that can be
|
102
|
* found in the LICENSE file at https://angular.io/license
|
103
|
*/
|
104
|
/**
|
105
|
* An implementation of {@link DirectiveResolver} that allows overriding
|
106
|
* various properties of directives.
|
107
|
*/
|
108
|
var MockDirectiveResolver = (function (_super) {
|
109
|
__extends(MockDirectiveResolver, _super);
|
110
|
function MockDirectiveResolver(_injector, reflector) {
|
111
|
var _this = _super.call(this, reflector) || this;
|
112
|
_this._injector = _injector;
|
113
|
_this._directives = new Map();
|
114
|
_this._providerOverrides = new Map();
|
115
|
_this._viewProviderOverrides = new Map();
|
116
|
_this._views = new Map();
|
117
|
_this._inlineTemplates = new Map();
|
118
|
return _this;
|
119
|
}
|
120
|
Object.defineProperty(MockDirectiveResolver.prototype, "_compiler", {
|
121
|
get: function () { return this._injector.get(_angular_core.Compiler); },
|
122
|
enumerable: true,
|
123
|
configurable: true
|
124
|
});
|
125
|
MockDirectiveResolver.prototype._clearCacheFor = function (component) { this._compiler.clearCacheFor(component); };
|
126
|
MockDirectiveResolver.prototype.resolve = function (type, throwIfNotFound) {
|
127
|
if (throwIfNotFound === void 0) { throwIfNotFound = true; }
|
128
|
var metadata = this._directives.get(type) || null;
|
129
|
if (!metadata) {
|
130
|
metadata = _super.prototype.resolve.call(this, type, throwIfNotFound);
|
131
|
}
|
132
|
if (!metadata) {
|
133
|
return null;
|
134
|
}
|
135
|
var providerOverrides = this._providerOverrides.get(type);
|
136
|
var viewProviderOverrides = this._viewProviderOverrides.get(type);
|
137
|
var providers = metadata.providers;
|
138
|
if (providerOverrides != null) {
|
139
|
var originalViewProviders = metadata.providers || [];
|
140
|
providers = originalViewProviders.concat(providerOverrides);
|
141
|
}
|
142
|
if (metadata instanceof _angular_core.Component) {
|
143
|
var viewProviders = metadata.viewProviders;
|
144
|
if (viewProviderOverrides != null) {
|
145
|
var originalViewProviders = metadata.viewProviders || [];
|
146
|
viewProviders = originalViewProviders.concat(viewProviderOverrides);
|
147
|
}
|
148
|
var view = this._views.get(type) || metadata;
|
149
|
var animations = view.animations;
|
150
|
var templateUrl = view.templateUrl;
|
151
|
var inlineTemplate = this._inlineTemplates.get(type);
|
152
|
if (inlineTemplate) {
|
153
|
templateUrl = undefined;
|
154
|
}
|
155
|
else {
|
156
|
inlineTemplate = view.template;
|
157
|
}
|
158
|
return new _angular_core.Component({
|
159
|
selector: metadata.selector,
|
160
|
inputs: metadata.inputs,
|
161
|
outputs: metadata.outputs,
|
162
|
host: metadata.host,
|
163
|
exportAs: metadata.exportAs,
|
164
|
moduleId: metadata.moduleId,
|
165
|
queries: metadata.queries,
|
166
|
changeDetection: metadata.changeDetection,
|
167
|
providers: providers,
|
168
|
viewProviders: viewProviders,
|
169
|
entryComponents: metadata.entryComponents,
|
170
|
template: inlineTemplate,
|
171
|
templateUrl: templateUrl,
|
172
|
animations: animations,
|
173
|
styles: view.styles,
|
174
|
styleUrls: view.styleUrls,
|
175
|
encapsulation: view.encapsulation,
|
176
|
interpolation: view.interpolation,
|
177
|
preserveWhitespaces: view.preserveWhitespaces,
|
178
|
});
|
179
|
}
|
180
|
return new _angular_core.Directive({
|
181
|
selector: metadata.selector,
|
182
|
inputs: metadata.inputs,
|
183
|
outputs: metadata.outputs,
|
184
|
host: metadata.host,
|
185
|
providers: providers,
|
186
|
exportAs: metadata.exportAs,
|
187
|
queries: metadata.queries
|
188
|
});
|
189
|
};
|
190
|
/**
|
191
|
* Overrides the {@link Directive} for a directive.
|
192
|
*/
|
193
|
MockDirectiveResolver.prototype.setDirective = function (type, metadata) {
|
194
|
this._directives.set(type, metadata);
|
195
|
this._clearCacheFor(type);
|
196
|
};
|
197
|
MockDirectiveResolver.prototype.setProvidersOverride = function (type, providers) {
|
198
|
this._providerOverrides.set(type, providers);
|
199
|
this._clearCacheFor(type);
|
200
|
};
|
201
|
MockDirectiveResolver.prototype.setViewProvidersOverride = function (type, viewProviders) {
|
202
|
this._viewProviderOverrides.set(type, viewProviders);
|
203
|
this._clearCacheFor(type);
|
204
|
};
|
205
|
/**
|
206
|
* Overrides the {@link ViewMetadata} for a component.
|
207
|
*/
|
208
|
MockDirectiveResolver.prototype.setView = function (component, view) {
|
209
|
this._views.set(component, view);
|
210
|
this._clearCacheFor(component);
|
211
|
};
|
212
|
/**
|
213
|
* Overrides the inline template for a component - other configuration remains unchanged.
|
214
|
*/
|
215
|
MockDirectiveResolver.prototype.setInlineTemplate = function (component, template) {
|
216
|
this._inlineTemplates.set(component, template);
|
217
|
this._clearCacheFor(component);
|
218
|
};
|
219
|
return MockDirectiveResolver;
|
220
|
}(_angular_compiler.DirectiveResolver));
|
221
|
MockDirectiveResolver.decorators = [
|
222
|
{ type: _angular_core.Injectable },
|
223
|
];
|
224
|
/** @nocollapse */
|
225
|
MockDirectiveResolver.ctorParameters = function () { return [
|
226
|
{ type: _angular_core.Injector, },
|
227
|
{ type: _angular_compiler.CompileReflector, },
|
228
|
]; };
|
229
|
/**
|
230
|
* @license
|
231
|
* Copyright Google Inc. All Rights Reserved.
|
232
|
*
|
233
|
* Use of this source code is governed by an MIT-style license that can be
|
234
|
* found in the LICENSE file at https://angular.io/license
|
235
|
*/
|
236
|
var MockNgModuleResolver = (function (_super) {
|
237
|
__extends(MockNgModuleResolver, _super);
|
238
|
function MockNgModuleResolver(_injector, reflector) {
|
239
|
var _this = _super.call(this, reflector) || this;
|
240
|
_this._injector = _injector;
|
241
|
_this._ngModules = new Map();
|
242
|
return _this;
|
243
|
}
|
244
|
/**
|
245
|
* Overrides the {@link NgModule} for a module.
|
246
|
*/
|
247
|
MockNgModuleResolver.prototype.setNgModule = function (type, metadata) {
|
248
|
this._ngModules.set(type, metadata);
|
249
|
this._clearCacheFor(type);
|
250
|
};
|
251
|
/**
|
252
|
* Returns the {@link NgModule} for a module:
|
253
|
* - Set the {@link NgModule} to the overridden view when it exists or fallback to the
|
254
|
* default
|
255
|
* `NgModuleResolver`, see `setNgModule`.
|
256
|
*/
|
257
|
MockNgModuleResolver.prototype.resolve = function (type, throwIfNotFound) {
|
258
|
if (throwIfNotFound === void 0) { throwIfNotFound = true; }
|
259
|
return this._ngModules.get(type) || _super.prototype.resolve.call(this, type, throwIfNotFound);
|
260
|
};
|
261
|
Object.defineProperty(MockNgModuleResolver.prototype, "_compiler", {
|
262
|
get: function () { return this._injector.get(_angular_core.Compiler); },
|
263
|
enumerable: true,
|
264
|
configurable: true
|
265
|
});
|
266
|
MockNgModuleResolver.prototype._clearCacheFor = function (component) { this._compiler.clearCacheFor(component); };
|
267
|
return MockNgModuleResolver;
|
268
|
}(_angular_compiler.NgModuleResolver));
|
269
|
MockNgModuleResolver.decorators = [
|
270
|
{ type: _angular_core.Injectable },
|
271
|
];
|
272
|
/** @nocollapse */
|
273
|
MockNgModuleResolver.ctorParameters = function () { return [
|
274
|
{ type: _angular_core.Injector, },
|
275
|
{ type: _angular_compiler.CompileReflector, },
|
276
|
]; };
|
277
|
/**
|
278
|
* @license
|
279
|
* Copyright Google Inc. All Rights Reserved.
|
280
|
*
|
281
|
* Use of this source code is governed by an MIT-style license that can be
|
282
|
* found in the LICENSE file at https://angular.io/license
|
283
|
*/
|
284
|
var MockPipeResolver = (function (_super) {
|
285
|
__extends(MockPipeResolver, _super);
|
286
|
function MockPipeResolver(_injector, refector) {
|
287
|
var _this = _super.call(this, refector) || this;
|
288
|
_this._injector = _injector;
|
289
|
_this._pipes = new Map();
|
290
|
return _this;
|
291
|
}
|
292
|
Object.defineProperty(MockPipeResolver.prototype, "_compiler", {
|
293
|
get: function () { return this._injector.get(_angular_core.Compiler); },
|
294
|
enumerable: true,
|
295
|
configurable: true
|
296
|
});
|
297
|
MockPipeResolver.prototype._clearCacheFor = function (pipe) { this._compiler.clearCacheFor(pipe); };
|
298
|
/**
|
299
|
* Overrides the {@link Pipe} for a pipe.
|
300
|
*/
|
301
|
MockPipeResolver.prototype.setPipe = function (type, metadata) {
|
302
|
this._pipes.set(type, metadata);
|
303
|
this._clearCacheFor(type);
|
304
|
};
|
305
|
/**
|
306
|
* Returns the {@link Pipe} for a pipe:
|
307
|
* - Set the {@link Pipe} to the overridden view when it exists or fallback to the
|
308
|
* default
|
309
|
* `PipeResolver`, see `setPipe`.
|
310
|
*/
|
311
|
MockPipeResolver.prototype.resolve = function (type, throwIfNotFound) {
|
312
|
if (throwIfNotFound === void 0) { throwIfNotFound = true; }
|
313
|
var metadata = this._pipes.get(type);
|
314
|
if (!metadata) {
|
315
|
metadata = _super.prototype.resolve.call(this, type, throwIfNotFound);
|
316
|
}
|
317
|
return metadata;
|
318
|
};
|
319
|
return MockPipeResolver;
|
320
|
}(_angular_compiler.PipeResolver));
|
321
|
MockPipeResolver.decorators = [
|
322
|
{ type: _angular_core.Injectable },
|
323
|
];
|
324
|
/** @nocollapse */
|
325
|
MockPipeResolver.ctorParameters = function () { return [
|
326
|
{ type: _angular_core.Injector, },
|
327
|
{ type: _angular_compiler.CompileReflector, },
|
328
|
]; };
|
329
|
/**
|
330
|
* @license
|
331
|
* Copyright Google Inc. All Rights Reserved.
|
332
|
*
|
333
|
* Use of this source code is governed by an MIT-style license that can be
|
334
|
* found in the LICENSE file at https://angular.io/license
|
335
|
*/
|
336
|
var _nextReferenceId = 0;
|
337
|
var MetadataOverrider = (function () {
|
338
|
function MetadataOverrider() {
|
339
|
this._references = new Map();
|
340
|
}
|
341
|
/**
|
342
|
* Creates a new instance for the given metadata class
|
343
|
* based on an old instance and overrides.
|
344
|
*/
|
345
|
MetadataOverrider.prototype.overrideMetadata = function (metadataClass, oldMetadata, override) {
|
346
|
var props = {};
|
347
|
if (oldMetadata) {
|
348
|
_valueProps(oldMetadata).forEach(function (prop) { return props[prop] = oldMetadata[prop]; });
|
349
|
}
|
350
|
if (override.set) {
|
351
|
if (override.remove || override.add) {
|
352
|
throw new Error("Cannot set and add/remove " + _angular_core.ɵstringify(metadataClass) + " at the same time!");
|
353
|
}
|
354
|
setMetadata(props, override.set);
|
355
|
}
|
356
|
if (override.remove) {
|
357
|
removeMetadata(props, override.remove, this._references);
|
358
|
}
|
359
|
if (override.add) {
|
360
|
addMetadata(props, override.add);
|
361
|
}
|
362
|
return new metadataClass(props);
|
363
|
};
|
364
|
return MetadataOverrider;
|
365
|
}());
|
366
|
function removeMetadata(metadata, remove, references) {
|
367
|
var removeObjects = new Set();
|
368
|
var _loop_1 = function (prop) {
|
369
|
var removeValue = remove[prop];
|
370
|
if (removeValue instanceof Array) {
|
371
|
removeValue.forEach(function (value) { removeObjects.add(_propHashKey(prop, value, references)); });
|
372
|
}
|
373
|
else {
|
374
|
removeObjects.add(_propHashKey(prop, removeValue, references));
|
375
|
}
|
376
|
};
|
377
|
for (var prop in remove) {
|
378
|
_loop_1(prop);
|
379
|
}
|
380
|
var _loop_2 = function (prop) {
|
381
|
var propValue = metadata[prop];
|
382
|
if (propValue instanceof Array) {
|
383
|
metadata[prop] = propValue.filter(function (value) { return !removeObjects.has(_propHashKey(prop, value, references)); });
|
384
|
}
|
385
|
else {
|
386
|
if (removeObjects.has(_propHashKey(prop, propValue, references))) {
|
387
|
metadata[prop] = undefined;
|
388
|
}
|
389
|
}
|
390
|
};
|
391
|
for (var prop in metadata) {
|
392
|
_loop_2(prop);
|
393
|
}
|
394
|
}
|
395
|
function addMetadata(metadata, add) {
|
396
|
for (var prop in add) {
|
397
|
var addValue = add[prop];
|
398
|
var propValue = metadata[prop];
|
399
|
if (propValue != null && propValue instanceof Array) {
|
400
|
metadata[prop] = propValue.concat(addValue);
|
401
|
}
|
402
|
else {
|
403
|
metadata[prop] = addValue;
|
404
|
}
|
405
|
}
|
406
|
}
|
407
|
function setMetadata(metadata, set) {
|
408
|
for (var prop in set) {
|
409
|
metadata[prop] = set[prop];
|
410
|
}
|
411
|
}
|
412
|
function _propHashKey(propName, propValue, references) {
|
413
|
var replacer = function (key, value) {
|
414
|
if (typeof value === 'function') {
|
415
|
value = _serializeReference(value, references);
|
416
|
}
|
417
|
return value;
|
418
|
};
|
419
|
return propName + ":" + JSON.stringify(propValue, replacer);
|
420
|
}
|
421
|
function _serializeReference(ref, references) {
|
422
|
var id = references.get(ref);
|
423
|
if (!id) {
|
424
|
id = "" + _angular_core.ɵstringify(ref) + _nextReferenceId++;
|
425
|
references.set(ref, id);
|
426
|
}
|
427
|
return id;
|
428
|
}
|
429
|
function _valueProps(obj) {
|
430
|
var props = [];
|
431
|
// regular public props
|
432
|
Object.keys(obj).forEach(function (prop) {
|
433
|
if (!prop.startsWith('_')) {
|
434
|
props.push(prop);
|
435
|
}
|
436
|
});
|
437
|
// getters
|
438
|
var proto = obj;
|
439
|
while (proto = Object.getPrototypeOf(proto)) {
|
440
|
Object.keys(proto).forEach(function (protoProp) {
|
441
|
var desc = Object.getOwnPropertyDescriptor(proto, protoProp);
|
442
|
if (!protoProp.startsWith('_') && desc && 'get' in desc) {
|
443
|
props.push(protoProp);
|
444
|
}
|
445
|
});
|
446
|
}
|
447
|
return props;
|
448
|
}
|
449
|
/**
|
450
|
* @license
|
451
|
* Copyright Google Inc. All Rights Reserved.
|
452
|
*
|
453
|
* Use of this source code is governed by an MIT-style license that can be
|
454
|
* found in the LICENSE file at https://angular.io/license
|
455
|
*/
|
456
|
/**
|
457
|
* @module
|
458
|
* @description
|
459
|
* Entry point for all APIs of the compiler package.
|
460
|
*
|
461
|
* <div class="callout is-critical">
|
462
|
* <header>Unstable APIs</header>
|
463
|
* <p>
|
464
|
* All compiler apis are currently considered experimental and private!
|
465
|
* </p>
|
466
|
* <p>
|
467
|
* We expect the APIs in this package to keep on changing. Do not rely on them.
|
468
|
* </p>
|
469
|
* </div>
|
470
|
*/
|
471
|
var TestingCompilerFactoryImpl = (function () {
|
472
|
function TestingCompilerFactoryImpl(_compilerFactory) {
|
473
|
this._compilerFactory = _compilerFactory;
|
474
|
}
|
475
|
TestingCompilerFactoryImpl.prototype.createTestingCompiler = function (options) {
|
476
|
var compiler = this._compilerFactory.createCompiler(options);
|
477
|
return new TestingCompilerImpl(compiler, compiler.injector.get(MockDirectiveResolver), compiler.injector.get(MockPipeResolver), compiler.injector.get(MockNgModuleResolver), compiler.injector.get(_angular_compiler.CompileMetadataResolver));
|
478
|
};
|
479
|
return TestingCompilerFactoryImpl;
|
480
|
}());
|
481
|
TestingCompilerFactoryImpl.decorators = [
|
482
|
{ type: _angular_core.Injectable },
|
483
|
];
|
484
|
/** @nocollapse */
|
485
|
TestingCompilerFactoryImpl.ctorParameters = function () { return [
|
486
|
{ type: _angular_core.CompilerFactory, },
|
487
|
]; };
|
488
|
var TestingCompilerImpl = (function () {
|
489
|
function TestingCompilerImpl(_compiler, _directiveResolver, _pipeResolver, _moduleResolver, _metadataResolver) {
|
490
|
this._compiler = _compiler;
|
491
|
this._directiveResolver = _directiveResolver;
|
492
|
this._pipeResolver = _pipeResolver;
|
493
|
this._moduleResolver = _moduleResolver;
|
494
|
this._metadataResolver = _metadataResolver;
|
495
|
this._overrider = new MetadataOverrider();
|
496
|
}
|
497
|
Object.defineProperty(TestingCompilerImpl.prototype, "injector", {
|
498
|
get: function () { return this._compiler.injector; },
|
499
|
enumerable: true,
|
500
|
configurable: true
|
501
|
});
|
502
|
TestingCompilerImpl.prototype.compileModuleSync = function (moduleType) {
|
503
|
return this._compiler.compileModuleSync(moduleType);
|
504
|
};
|
505
|
TestingCompilerImpl.prototype.compileModuleAsync = function (moduleType) {
|
506
|
return this._compiler.compileModuleAsync(moduleType);
|
507
|
};
|
508
|
TestingCompilerImpl.prototype.compileModuleAndAllComponentsSync = function (moduleType) {
|
509
|
return this._compiler.compileModuleAndAllComponentsSync(moduleType);
|
510
|
};
|
511
|
TestingCompilerImpl.prototype.compileModuleAndAllComponentsAsync = function (moduleType) {
|
512
|
return this._compiler.compileModuleAndAllComponentsAsync(moduleType);
|
513
|
};
|
514
|
TestingCompilerImpl.prototype.getNgContentSelectors = function (component) {
|
515
|
return this._compiler.getNgContentSelectors(component);
|
516
|
};
|
517
|
TestingCompilerImpl.prototype.getComponentFactory = function (component) {
|
518
|
return this._compiler.getComponentFactory(component);
|
519
|
};
|
520
|
TestingCompilerImpl.prototype.checkOverrideAllowed = function (type) {
|
521
|
if (this._compiler.hasAotSummary(type)) {
|
522
|
throw new Error(_angular_core.ɵstringify(type) + " was AOT compiled, so its metadata cannot be changed.");
|
523
|
}
|
524
|
};
|
525
|
TestingCompilerImpl.prototype.overrideModule = function (ngModule, override) {
|
526
|
this.checkOverrideAllowed(ngModule);
|
527
|
var oldMetadata = this._moduleResolver.resolve(ngModule, false);
|
528
|
this._moduleResolver.setNgModule(ngModule, this._overrider.overrideMetadata(_angular_core.NgModule, oldMetadata, override));
|
529
|
};
|
530
|
TestingCompilerImpl.prototype.overrideDirective = function (directive, override) {
|
531
|
this.checkOverrideAllowed(directive);
|
532
|
var oldMetadata = this._directiveResolver.resolve(directive, false);
|
533
|
this._directiveResolver.setDirective(directive, this._overrider.overrideMetadata(_angular_core.Directive, oldMetadata, override));
|
534
|
};
|
535
|
TestingCompilerImpl.prototype.overrideComponent = function (component, override) {
|
536
|
this.checkOverrideAllowed(component);
|
537
|
var oldMetadata = this._directiveResolver.resolve(component, false);
|
538
|
this._directiveResolver.setDirective(component, this._overrider.overrideMetadata(_angular_core.Component, oldMetadata, override));
|
539
|
};
|
540
|
TestingCompilerImpl.prototype.overridePipe = function (pipe, override) {
|
541
|
this.checkOverrideAllowed(pipe);
|
542
|
var oldMetadata = this._pipeResolver.resolve(pipe, false);
|
543
|
this._pipeResolver.setPipe(pipe, this._overrider.overrideMetadata(_angular_core.Pipe, oldMetadata, override));
|
544
|
};
|
545
|
TestingCompilerImpl.prototype.loadAotSummaries = function (summaries) { this._compiler.loadAotSummaries(summaries); };
|
546
|
TestingCompilerImpl.prototype.clearCache = function () { this._compiler.clearCache(); };
|
547
|
TestingCompilerImpl.prototype.clearCacheFor = function (type) { this._compiler.clearCacheFor(type); };
|
548
|
return TestingCompilerImpl;
|
549
|
}());
|
550
|
/**
|
551
|
* Platform for dynamic tests
|
552
|
*
|
553
|
* @experimental
|
554
|
*/
|
555
|
var platformCoreDynamicTesting = _angular_core.createPlatformFactory(_angular_compiler.platformCoreDynamic, 'coreDynamicTesting', [
|
556
|
{
|
557
|
provide: _angular_core.COMPILER_OPTIONS,
|
558
|
useValue: {
|
559
|
providers: [
|
560
|
MockPipeResolver,
|
561
|
{ provide: _angular_compiler.PipeResolver, useExisting: MockPipeResolver },
|
562
|
MockDirectiveResolver,
|
563
|
{ provide: _angular_compiler.DirectiveResolver, useExisting: MockDirectiveResolver },
|
564
|
MockNgModuleResolver,
|
565
|
{ provide: _angular_compiler.NgModuleResolver, useExisting: MockNgModuleResolver },
|
566
|
]
|
567
|
},
|
568
|
multi: true
|
569
|
},
|
570
|
{ provide: _angular_core_testing.ɵTestingCompilerFactory, useClass: TestingCompilerFactoryImpl }
|
571
|
]);
|
572
|
|
573
|
exports.TestingCompilerFactoryImpl = TestingCompilerFactoryImpl;
|
574
|
exports.TestingCompilerImpl = TestingCompilerImpl;
|
575
|
exports.platformCoreDynamicTesting = platformCoreDynamicTesting;
|
576
|
exports.MockSchemaRegistry = MockSchemaRegistry;
|
577
|
exports.MockDirectiveResolver = MockDirectiveResolver;
|
578
|
exports.MockNgModuleResolver = MockNgModuleResolver;
|
579
|
exports.MockPipeResolver = MockPipeResolver;
|
580
|
|
581
|
Object.defineProperty(exports, '__esModule', { value: true });
|
582
|
|
583
|
})));
|
584
|
//# sourceMappingURL=compiler-testing.umd.js.map
|