1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | (function (global, factory) {
|
8 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/core/testing'), require('@angular/platform-browser-dynamic'), require('@angular/platform-browser/testing'), require('@angular/common'), require('@angular/compiler'), require('@angular/compiler/testing')) :
|
9 | typeof define === 'function' && define.amd ? define('@angular/platform-browser-dynamic/testing', ['exports', '@angular/core', '@angular/core/testing', '@angular/platform-browser-dynamic', '@angular/platform-browser/testing', '@angular/common', '@angular/compiler', '@angular/compiler/testing'], factory) :
|
10 | (global = global || self, factory((global.ng = global.ng || {}, global.ng.platformBrowserDynamic = global.ng.platformBrowserDynamic || {}, global.ng.platformBrowserDynamic.testing = {}), global.ng.core, global.ng.core.testing, global.ng.platformBrowserDynamic, global.ng.platformBrowser.testing, global.ng.common, global.ng.compiler, global.ng.compiler.testing));
|
11 | }(this, (function (exports, core, testing, platformBrowserDynamic, testing$1, common, compiler, testing$2) { 'use strict';
|
12 |
|
13 | |
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 | var extendStatics = function(d, b) {
|
30 | extendStatics = Object.setPrototypeOf ||
|
31 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
32 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
33 | return extendStatics(d, b);
|
34 | };
|
35 |
|
36 | function __extends(d, b) {
|
37 | extendStatics(d, b);
|
38 | function __() { this.constructor = d; }
|
39 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
40 | }
|
41 |
|
42 | var __assign = function() {
|
43 | __assign = Object.assign || function __assign(t) {
|
44 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
45 | s = arguments[i];
|
46 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
47 | }
|
48 | return t;
|
49 | };
|
50 | return __assign.apply(this, arguments);
|
51 | };
|
52 |
|
53 | function __rest(s, e) {
|
54 | var t = {};
|
55 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
56 | t[p] = s[p];
|
57 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
58 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
59 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
60 | t[p[i]] = s[p[i]];
|
61 | }
|
62 | return t;
|
63 | }
|
64 |
|
65 | function __decorate(decorators, target, key, desc) {
|
66 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
67 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
68 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
69 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
70 | }
|
71 |
|
72 | function __param(paramIndex, decorator) {
|
73 | return function (target, key) { decorator(target, key, paramIndex); }
|
74 | }
|
75 |
|
76 | function __metadata(metadataKey, metadataValue) {
|
77 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
78 | }
|
79 |
|
80 | function __awaiter(thisArg, _arguments, P, generator) {
|
81 | return new (P || (P = Promise))(function (resolve, reject) {
|
82 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
83 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
84 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
85 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
86 | });
|
87 | }
|
88 |
|
89 | function __generator(thisArg, body) {
|
90 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
91 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
92 | function verb(n) { return function (v) { return step([n, v]); }; }
|
93 | function step(op) {
|
94 | if (f) throw new TypeError("Generator is already executing.");
|
95 | while (_) try {
|
96 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
97 | if (y = 0, t) op = [op[0] & 2, t.value];
|
98 | switch (op[0]) {
|
99 | case 0: case 1: t = op; break;
|
100 | case 4: _.label++; return { value: op[1], done: false };
|
101 | case 5: _.label++; y = op[1]; op = [0]; continue;
|
102 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
103 | default:
|
104 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
105 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
106 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
107 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
108 | if (t[2]) _.ops.pop();
|
109 | _.trys.pop(); continue;
|
110 | }
|
111 | op = body.call(thisArg, _);
|
112 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
113 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
114 | }
|
115 | }
|
116 |
|
117 | function __exportStar(m, exports) {
|
118 | for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
119 | }
|
120 |
|
121 | function __values(o) {
|
122 | var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
|
123 | if (m) return m.call(o);
|
124 | return {
|
125 | next: function () {
|
126 | if (o && i >= o.length) o = void 0;
|
127 | return { value: o && o[i++], done: !o };
|
128 | }
|
129 | };
|
130 | }
|
131 |
|
132 | function __read(o, n) {
|
133 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
134 | if (!m) return o;
|
135 | var i = m.call(o), r, ar = [], e;
|
136 | try {
|
137 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
138 | }
|
139 | catch (error) { e = { error: error }; }
|
140 | finally {
|
141 | try {
|
142 | if (r && !r.done && (m = i["return"])) m.call(i);
|
143 | }
|
144 | finally { if (e) throw e.error; }
|
145 | }
|
146 | return ar;
|
147 | }
|
148 |
|
149 | function __spread() {
|
150 | for (var ar = [], i = 0; i < arguments.length; i++)
|
151 | ar = ar.concat(__read(arguments[i]));
|
152 | return ar;
|
153 | }
|
154 |
|
155 | function __spreadArrays() {
|
156 | for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
157 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
158 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
159 | r[k] = a[j];
|
160 | return r;
|
161 | };
|
162 |
|
163 | function __await(v) {
|
164 | return this instanceof __await ? (this.v = v, this) : new __await(v);
|
165 | }
|
166 |
|
167 | function __asyncGenerator(thisArg, _arguments, generator) {
|
168 | if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
169 | var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
170 | return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
171 | function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
172 | function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
173 | function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
174 | function fulfill(value) { resume("next", value); }
|
175 | function reject(value) { resume("throw", value); }
|
176 | function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
177 | }
|
178 |
|
179 | function __asyncDelegator(o) {
|
180 | var i, p;
|
181 | return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
182 | function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
183 | }
|
184 |
|
185 | function __asyncValues(o) {
|
186 | if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
187 | var m = o[Symbol.asyncIterator], i;
|
188 | return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
189 | function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
190 | function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
191 | }
|
192 |
|
193 | function __makeTemplateObject(cooked, raw) {
|
194 | if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
195 | return cooked;
|
196 | };
|
197 |
|
198 | function __importStar(mod) {
|
199 | if (mod && mod.__esModule) return mod;
|
200 | var result = {};
|
201 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
202 | result.default = mod;
|
203 | return result;
|
204 | }
|
205 |
|
206 | function __importDefault(mod) {
|
207 | return (mod && mod.__esModule) ? mod : { default: mod };
|
208 | }
|
209 |
|
210 | |
211 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 | |
218 |
|
219 |
|
220 | var DOMTestComponentRenderer = (function (_super) {
|
221 | __extends(DOMTestComponentRenderer, _super);
|
222 | function DOMTestComponentRenderer(_doc) {
|
223 | var _this = _super.call(this) || this;
|
224 | _this._doc = _doc;
|
225 | return _this;
|
226 | }
|
227 | DOMTestComponentRenderer.prototype.insertRootElement = function (rootElId) {
|
228 | var template = common.ɵgetDOM().getDefaultDocument().createElement('template');
|
229 | template.innerHTML = "<div id=\"" + rootElId + "\"></div>";
|
230 | var rootEl = getContent(template).firstChild;
|
231 |
|
232 | var oldRoots = this._doc.querySelectorAll('[id^=root]');
|
233 | for (var i = 0; i < oldRoots.length; i++) {
|
234 | common.ɵgetDOM().remove(oldRoots[i]);
|
235 | }
|
236 | this._doc.body.appendChild(rootEl);
|
237 | };
|
238 | DOMTestComponentRenderer = __decorate([
|
239 | core.Injectable(),
|
240 | __param(0, core.Inject(common.DOCUMENT)),
|
241 | __metadata("design:paramtypes", [Object])
|
242 | ], DOMTestComponentRenderer);
|
243 | return DOMTestComponentRenderer;
|
244 | }(testing.TestComponentRenderer));
|
245 | function getContent(node) {
|
246 | if ('content' in node) {
|
247 | return node.content;
|
248 | }
|
249 | else {
|
250 | return node;
|
251 | }
|
252 | }
|
253 |
|
254 | |
255 |
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 | |
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 | var COMPILER_PROVIDERS = [
|
270 | { provide: testing$2.MockPipeResolver, deps: [compiler.CompileReflector] },
|
271 | { provide: compiler.PipeResolver, useExisting: testing$2.MockPipeResolver },
|
272 | { provide: testing$2.MockDirectiveResolver, deps: [compiler.CompileReflector] },
|
273 | { provide: compiler.DirectiveResolver, useExisting: testing$2.MockDirectiveResolver },
|
274 | { provide: testing$2.MockNgModuleResolver, deps: [compiler.CompileReflector] },
|
275 | { provide: compiler.NgModuleResolver, useExisting: testing$2.MockNgModuleResolver },
|
276 | ];
|
277 | var TestingCompilerFactoryImpl = (function () {
|
278 | function TestingCompilerFactoryImpl(_injector, _compilerFactory) {
|
279 | this._injector = _injector;
|
280 | this._compilerFactory = _compilerFactory;
|
281 | }
|
282 | TestingCompilerFactoryImpl.prototype.createTestingCompiler = function (options) {
|
283 | var compiler = this._compilerFactory.createCompiler(options);
|
284 | return new TestingCompilerImpl(compiler, compiler.injector.get(testing$2.MockDirectiveResolver), compiler.injector.get(testing$2.MockPipeResolver), compiler.injector.get(testing$2.MockNgModuleResolver));
|
285 | };
|
286 | return TestingCompilerFactoryImpl;
|
287 | }());
|
288 | var TestingCompilerImpl = (function () {
|
289 | function TestingCompilerImpl(_compiler, _directiveResolver, _pipeResolver, _moduleResolver) {
|
290 | this._compiler = _compiler;
|
291 | this._directiveResolver = _directiveResolver;
|
292 | this._pipeResolver = _pipeResolver;
|
293 | this._moduleResolver = _moduleResolver;
|
294 | this._overrider = new testing.ɵMetadataOverrider();
|
295 | }
|
296 | Object.defineProperty(TestingCompilerImpl.prototype, "injector", {
|
297 | get: function () { return this._compiler.injector; },
|
298 | enumerable: true,
|
299 | configurable: true
|
300 | });
|
301 | TestingCompilerImpl.prototype.compileModuleSync = function (moduleType) {
|
302 | return this._compiler.compileModuleSync(moduleType);
|
303 | };
|
304 | TestingCompilerImpl.prototype.compileModuleAsync = function (moduleType) {
|
305 | return this._compiler.compileModuleAsync(moduleType);
|
306 | };
|
307 | TestingCompilerImpl.prototype.compileModuleAndAllComponentsSync = function (moduleType) {
|
308 | return this._compiler.compileModuleAndAllComponentsSync(moduleType);
|
309 | };
|
310 | TestingCompilerImpl.prototype.compileModuleAndAllComponentsAsync = function (moduleType) {
|
311 | return this._compiler.compileModuleAndAllComponentsAsync(moduleType);
|
312 | };
|
313 | TestingCompilerImpl.prototype.getComponentFactory = function (component) {
|
314 | return this._compiler.getComponentFactory(component);
|
315 | };
|
316 | TestingCompilerImpl.prototype.checkOverrideAllowed = function (type) {
|
317 | if (this._compiler.hasAotSummary(type)) {
|
318 | throw new Error(core.ɵstringify(type) + " was AOT compiled, so its metadata cannot be changed.");
|
319 | }
|
320 | };
|
321 | TestingCompilerImpl.prototype.overrideModule = function (ngModule, override) {
|
322 | this.checkOverrideAllowed(ngModule);
|
323 | var oldMetadata = this._moduleResolver.resolve(ngModule, false);
|
324 | this._moduleResolver.setNgModule(ngModule, this._overrider.overrideMetadata(core.NgModule, oldMetadata, override));
|
325 | this.clearCacheFor(ngModule);
|
326 | };
|
327 | TestingCompilerImpl.prototype.overrideDirective = function (directive, override) {
|
328 | this.checkOverrideAllowed(directive);
|
329 | var oldMetadata = this._directiveResolver.resolve(directive, false);
|
330 | this._directiveResolver.setDirective(directive, this._overrider.overrideMetadata(core.Directive, oldMetadata, override));
|
331 | this.clearCacheFor(directive);
|
332 | };
|
333 | TestingCompilerImpl.prototype.overrideComponent = function (component, override) {
|
334 | this.checkOverrideAllowed(component);
|
335 | var oldMetadata = this._directiveResolver.resolve(component, false);
|
336 | this._directiveResolver.setDirective(component, this._overrider.overrideMetadata(core.Component, oldMetadata, override));
|
337 | this.clearCacheFor(component);
|
338 | };
|
339 | TestingCompilerImpl.prototype.overridePipe = function (pipe, override) {
|
340 | this.checkOverrideAllowed(pipe);
|
341 | var oldMetadata = this._pipeResolver.resolve(pipe, false);
|
342 | this._pipeResolver.setPipe(pipe, this._overrider.overrideMetadata(core.Pipe, oldMetadata, override));
|
343 | this.clearCacheFor(pipe);
|
344 | };
|
345 | TestingCompilerImpl.prototype.loadAotSummaries = function (summaries) { this._compiler.loadAotSummaries(summaries); };
|
346 | TestingCompilerImpl.prototype.clearCache = function () { this._compiler.clearCache(); };
|
347 | TestingCompilerImpl.prototype.clearCacheFor = function (type) { this._compiler.clearCacheFor(type); };
|
348 | TestingCompilerImpl.prototype.getComponentFromError = function (error) { return error[compiler.ERROR_COMPONENT_TYPE] || null; };
|
349 | TestingCompilerImpl.prototype.getModuleId = function (moduleType) {
|
350 | return this._moduleResolver.resolve(moduleType, true).id;
|
351 | };
|
352 | return TestingCompilerImpl;
|
353 | }());
|
354 |
|
355 | |
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 | var ɵ0 = { providers: COMPILER_PROVIDERS };
|
363 | |
364 |
|
365 |
|
366 |
|
367 |
|
368 | var platformCoreDynamicTesting = core.createPlatformFactory(platformBrowserDynamic.ɵplatformCoreDynamic, 'coreDynamicTesting', [
|
369 | { provide: core.COMPILER_OPTIONS, useValue: ɵ0, multi: true }, {
|
370 | provide: testing.ɵTestingCompilerFactory,
|
371 | useClass: TestingCompilerFactoryImpl,
|
372 | deps: [core.Injector, core.CompilerFactory]
|
373 | }
|
374 | ]);
|
375 |
|
376 | |
377 |
|
378 |
|
379 |
|
380 |
|
381 |
|
382 |
|
383 |
|
384 | |
385 |
|
386 |
|
387 |
|
388 |
|
389 |
|
390 |
|
391 | |
392 |
|
393 |
|
394 | var platformBrowserDynamicTesting = core.createPlatformFactory(platformCoreDynamicTesting, 'browserDynamicTesting', platformBrowserDynamic.ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
|
395 | |
396 |
|
397 |
|
398 |
|
399 |
|
400 | var BrowserDynamicTestingModule = (function () {
|
401 | function BrowserDynamicTestingModule() {
|
402 | }
|
403 | BrowserDynamicTestingModule = __decorate([
|
404 | core.NgModule({
|
405 | exports: [testing$1.BrowserTestingModule],
|
406 | providers: [
|
407 | { provide: testing.TestComponentRenderer, useClass: DOMTestComponentRenderer },
|
408 | ]
|
409 | })
|
410 | ], BrowserDynamicTestingModule);
|
411 | return BrowserDynamicTestingModule;
|
412 | }());
|
413 |
|
414 | |
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 | |
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 |
|
430 | |
431 |
|
432 |
|
433 |
|
434 | exports.BrowserDynamicTestingModule = BrowserDynamicTestingModule;
|
435 | exports.platformBrowserDynamicTesting = platformBrowserDynamicTesting;
|
436 | exports.ɵDOMTestComponentRenderer = DOMTestComponentRenderer;
|
437 | exports.ɵangular_packages_platform_browser_dynamic_testing_testing_a = COMPILER_PROVIDERS;
|
438 | exports.ɵangular_packages_platform_browser_dynamic_testing_testing_b = TestingCompilerFactoryImpl;
|
439 | exports.ɵplatformCoreDynamicTesting = platformCoreDynamicTesting;
|
440 |
|
441 | Object.defineProperty(exports, '__esModule', { value: true });
|
442 |
|
443 | })));
|
444 |
|