1 | (function (global, factory) {
|
---|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs')) :
|
---|
3 | typeof define === 'function' && define.amd ? define('@angular/cdk/testing', ['exports', 'rxjs'], factory) :
|
---|
4 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ng = global.ng || {}, global.ng.cdk = global.ng.cdk || {}, global.ng.cdk.testing = {}), global.rxjs));
|
---|
5 | }(this, (function (exports, rxjs) { 'use strict';
|
---|
6 |
|
---|
7 | /*! *****************************************************************************
|
---|
8 | Copyright (c) Microsoft Corporation.
|
---|
9 |
|
---|
10 | Permission to use, copy, modify, and/or distribute this software for any
|
---|
11 | purpose with or without fee is hereby granted.
|
---|
12 |
|
---|
13 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
---|
14 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
---|
15 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
---|
16 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
---|
17 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
---|
18 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
---|
19 | PERFORMANCE OF THIS SOFTWARE.
|
---|
20 | ***************************************************************************** */
|
---|
21 | /* global Reflect, Promise */
|
---|
22 | var extendStatics = function (d, b) {
|
---|
23 | extendStatics = Object.setPrototypeOf ||
|
---|
24 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
---|
25 | function (d, b) { for (var p in b)
|
---|
26 | if (Object.prototype.hasOwnProperty.call(b, p))
|
---|
27 | d[p] = b[p]; };
|
---|
28 | return extendStatics(d, b);
|
---|
29 | };
|
---|
30 | function __extends(d, b) {
|
---|
31 | if (typeof b !== "function" && b !== null)
|
---|
32 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
---|
33 | extendStatics(d, b);
|
---|
34 | function __() { this.constructor = d; }
|
---|
35 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
---|
36 | }
|
---|
37 | var __assign = function () {
|
---|
38 | __assign = Object.assign || function __assign(t) {
|
---|
39 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
---|
40 | s = arguments[i];
|
---|
41 | for (var p in s)
|
---|
42 | if (Object.prototype.hasOwnProperty.call(s, p))
|
---|
43 | t[p] = s[p];
|
---|
44 | }
|
---|
45 | return t;
|
---|
46 | };
|
---|
47 | return __assign.apply(this, arguments);
|
---|
48 | };
|
---|
49 | function __rest(s, e) {
|
---|
50 | var t = {};
|
---|
51 | for (var p in s)
|
---|
52 | if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
---|
53 | t[p] = s[p];
|
---|
54 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
---|
55 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
---|
56 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
---|
57 | t[p[i]] = s[p[i]];
|
---|
58 | }
|
---|
59 | return t;
|
---|
60 | }
|
---|
61 | function __decorate(decorators, target, key, desc) {
|
---|
62 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
---|
63 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
---|
64 | r = Reflect.decorate(decorators, target, key, desc);
|
---|
65 | else
|
---|
66 | for (var i = decorators.length - 1; i >= 0; i--)
|
---|
67 | if (d = decorators[i])
|
---|
68 | 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 | function __param(paramIndex, decorator) {
|
---|
72 | return function (target, key) { decorator(target, key, paramIndex); };
|
---|
73 | }
|
---|
74 | function __metadata(metadataKey, metadataValue) {
|
---|
75 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
---|
76 | return Reflect.metadata(metadataKey, metadataValue);
|
---|
77 | }
|
---|
78 | function __awaiter(thisArg, _arguments, P, generator) {
|
---|
79 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
---|
80 | return new (P || (P = Promise))(function (resolve, reject) {
|
---|
81 | function fulfilled(value) { try {
|
---|
82 | step(generator.next(value));
|
---|
83 | }
|
---|
84 | catch (e) {
|
---|
85 | reject(e);
|
---|
86 | } }
|
---|
87 | function rejected(value) { try {
|
---|
88 | step(generator["throw"](value));
|
---|
89 | }
|
---|
90 | catch (e) {
|
---|
91 | reject(e);
|
---|
92 | } }
|
---|
93 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
---|
94 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
---|
95 | });
|
---|
96 | }
|
---|
97 | function __generator(thisArg, body) {
|
---|
98 | var _ = { label: 0, sent: function () { if (t[0] & 1)
|
---|
99 | throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
---|
100 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
---|
101 | function verb(n) { return function (v) { return step([n, v]); }; }
|
---|
102 | function step(op) {
|
---|
103 | if (f)
|
---|
104 | throw new TypeError("Generator is already executing.");
|
---|
105 | while (_)
|
---|
106 | try {
|
---|
107 | 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)
|
---|
108 | return t;
|
---|
109 | if (y = 0, t)
|
---|
110 | op = [op[0] & 2, t.value];
|
---|
111 | switch (op[0]) {
|
---|
112 | case 0:
|
---|
113 | case 1:
|
---|
114 | t = op;
|
---|
115 | break;
|
---|
116 | case 4:
|
---|
117 | _.label++;
|
---|
118 | return { value: op[1], done: false };
|
---|
119 | case 5:
|
---|
120 | _.label++;
|
---|
121 | y = op[1];
|
---|
122 | op = [0];
|
---|
123 | continue;
|
---|
124 | case 7:
|
---|
125 | op = _.ops.pop();
|
---|
126 | _.trys.pop();
|
---|
127 | continue;
|
---|
128 | default:
|
---|
129 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
---|
130 | _ = 0;
|
---|
131 | continue;
|
---|
132 | }
|
---|
133 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
---|
134 | _.label = op[1];
|
---|
135 | break;
|
---|
136 | }
|
---|
137 | if (op[0] === 6 && _.label < t[1]) {
|
---|
138 | _.label = t[1];
|
---|
139 | t = op;
|
---|
140 | break;
|
---|
141 | }
|
---|
142 | if (t && _.label < t[2]) {
|
---|
143 | _.label = t[2];
|
---|
144 | _.ops.push(op);
|
---|
145 | break;
|
---|
146 | }
|
---|
147 | if (t[2])
|
---|
148 | _.ops.pop();
|
---|
149 | _.trys.pop();
|
---|
150 | continue;
|
---|
151 | }
|
---|
152 | op = body.call(thisArg, _);
|
---|
153 | }
|
---|
154 | catch (e) {
|
---|
155 | op = [6, e];
|
---|
156 | y = 0;
|
---|
157 | }
|
---|
158 | finally {
|
---|
159 | f = t = 0;
|
---|
160 | }
|
---|
161 | if (op[0] & 5)
|
---|
162 | throw op[1];
|
---|
163 | return { value: op[0] ? op[1] : void 0, done: true };
|
---|
164 | }
|
---|
165 | }
|
---|
166 | var __createBinding = Object.create ? (function (o, m, k, k2) {
|
---|
167 | if (k2 === undefined)
|
---|
168 | k2 = k;
|
---|
169 | Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
---|
170 | }) : (function (o, m, k, k2) {
|
---|
171 | if (k2 === undefined)
|
---|
172 | k2 = k;
|
---|
173 | o[k2] = m[k];
|
---|
174 | });
|
---|
175 | function __exportStar(m, o) {
|
---|
176 | for (var p in m)
|
---|
177 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
---|
178 | __createBinding(o, m, p);
|
---|
179 | }
|
---|
180 | function __values(o) {
|
---|
181 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
---|
182 | if (m)
|
---|
183 | return m.call(o);
|
---|
184 | if (o && typeof o.length === "number")
|
---|
185 | return {
|
---|
186 | next: function () {
|
---|
187 | if (o && i >= o.length)
|
---|
188 | o = void 0;
|
---|
189 | return { value: o && o[i++], done: !o };
|
---|
190 | }
|
---|
191 | };
|
---|
192 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
---|
193 | }
|
---|
194 | function __read(o, n) {
|
---|
195 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
---|
196 | if (!m)
|
---|
197 | return o;
|
---|
198 | var i = m.call(o), r, ar = [], e;
|
---|
199 | try {
|
---|
200 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
---|
201 | ar.push(r.value);
|
---|
202 | }
|
---|
203 | catch (error) {
|
---|
204 | e = { error: error };
|
---|
205 | }
|
---|
206 | finally {
|
---|
207 | try {
|
---|
208 | if (r && !r.done && (m = i["return"]))
|
---|
209 | m.call(i);
|
---|
210 | }
|
---|
211 | finally {
|
---|
212 | if (e)
|
---|
213 | throw e.error;
|
---|
214 | }
|
---|
215 | }
|
---|
216 | return ar;
|
---|
217 | }
|
---|
218 | /** @deprecated */
|
---|
219 | function __spread() {
|
---|
220 | for (var ar = [], i = 0; i < arguments.length; i++)
|
---|
221 | ar = ar.concat(__read(arguments[i]));
|
---|
222 | return ar;
|
---|
223 | }
|
---|
224 | /** @deprecated */
|
---|
225 | function __spreadArrays() {
|
---|
226 | for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
---|
227 | s += arguments[i].length;
|
---|
228 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
---|
229 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
---|
230 | r[k] = a[j];
|
---|
231 | return r;
|
---|
232 | }
|
---|
233 | function __spreadArray(to, from, pack) {
|
---|
234 | if (pack || arguments.length === 2)
|
---|
235 | for (var i = 0, l = from.length, ar; i < l; i++) {
|
---|
236 | if (ar || !(i in from)) {
|
---|
237 | if (!ar)
|
---|
238 | ar = Array.prototype.slice.call(from, 0, i);
|
---|
239 | ar[i] = from[i];
|
---|
240 | }
|
---|
241 | }
|
---|
242 | return to.concat(ar || from);
|
---|
243 | }
|
---|
244 | function __await(v) {
|
---|
245 | return this instanceof __await ? (this.v = v, this) : new __await(v);
|
---|
246 | }
|
---|
247 | function __asyncGenerator(thisArg, _arguments, generator) {
|
---|
248 | if (!Symbol.asyncIterator)
|
---|
249 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
---|
250 | var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
---|
251 | return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
---|
252 | function verb(n) { if (g[n])
|
---|
253 | i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
---|
254 | function resume(n, v) { try {
|
---|
255 | step(g[n](v));
|
---|
256 | }
|
---|
257 | catch (e) {
|
---|
258 | settle(q[0][3], e);
|
---|
259 | } }
|
---|
260 | function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
---|
261 | function fulfill(value) { resume("next", value); }
|
---|
262 | function reject(value) { resume("throw", value); }
|
---|
263 | function settle(f, v) { if (f(v), q.shift(), q.length)
|
---|
264 | resume(q[0][0], q[0][1]); }
|
---|
265 | }
|
---|
266 | function __asyncDelegator(o) {
|
---|
267 | var i, p;
|
---|
268 | return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
---|
269 | 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; }
|
---|
270 | }
|
---|
271 | function __asyncValues(o) {
|
---|
272 | if (!Symbol.asyncIterator)
|
---|
273 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
---|
274 | var m = o[Symbol.asyncIterator], i;
|
---|
275 | 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);
|
---|
276 | 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); }); }; }
|
---|
277 | function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
---|
278 | }
|
---|
279 | function __makeTemplateObject(cooked, raw) {
|
---|
280 | if (Object.defineProperty) {
|
---|
281 | Object.defineProperty(cooked, "raw", { value: raw });
|
---|
282 | }
|
---|
283 | else {
|
---|
284 | cooked.raw = raw;
|
---|
285 | }
|
---|
286 | return cooked;
|
---|
287 | }
|
---|
288 | ;
|
---|
289 | var __setModuleDefault = Object.create ? (function (o, v) {
|
---|
290 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
---|
291 | }) : function (o, v) {
|
---|
292 | o["default"] = v;
|
---|
293 | };
|
---|
294 | function __importStar(mod) {
|
---|
295 | if (mod && mod.__esModule)
|
---|
296 | return mod;
|
---|
297 | var result = {};
|
---|
298 | if (mod != null)
|
---|
299 | for (var k in mod)
|
---|
300 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
---|
301 | __createBinding(result, mod, k);
|
---|
302 | __setModuleDefault(result, mod);
|
---|
303 | return result;
|
---|
304 | }
|
---|
305 | function __importDefault(mod) {
|
---|
306 | return (mod && mod.__esModule) ? mod : { default: mod };
|
---|
307 | }
|
---|
308 | function __classPrivateFieldGet(receiver, state, kind, f) {
|
---|
309 | if (kind === "a" && !f)
|
---|
310 | throw new TypeError("Private accessor was defined without a getter");
|
---|
311 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
---|
312 | throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
---|
313 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
---|
314 | }
|
---|
315 | function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
---|
316 | if (kind === "m")
|
---|
317 | throw new TypeError("Private method is not writable");
|
---|
318 | if (kind === "a" && !f)
|
---|
319 | throw new TypeError("Private accessor was defined without a setter");
|
---|
320 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
---|
321 | throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
---|
322 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
---|
323 | }
|
---|
324 |
|
---|
325 | /** Subject used to dispatch and listen for changes to the auto change detection status . */
|
---|
326 | var autoChangeDetectionSubject = new rxjs.BehaviorSubject({
|
---|
327 | isDisabled: false
|
---|
328 | });
|
---|
329 | /** The current subscription to `autoChangeDetectionSubject`. */
|
---|
330 | var autoChangeDetectionSubscription;
|
---|
331 | /**
|
---|
332 | * The default handler for auto change detection status changes. This handler will be used if the
|
---|
333 | * specific environment does not install its own.
|
---|
334 | * @param status The new auto change detection status.
|
---|
335 | */
|
---|
336 | function defaultAutoChangeDetectionHandler(status) {
|
---|
337 | var _a;
|
---|
338 | (_a = status.onDetectChangesNow) === null || _a === void 0 ? void 0 : _a.call(status);
|
---|
339 | }
|
---|
340 | /**
|
---|
341 | * Allows a test `HarnessEnvironment` to install its own handler for auto change detection status
|
---|
342 | * changes.
|
---|
343 | * @param handler The handler for the auto change detection status.
|
---|
344 | */
|
---|
345 | function handleAutoChangeDetectionStatus(handler) {
|
---|
346 | stopHandlingAutoChangeDetectionStatus();
|
---|
347 | autoChangeDetectionSubscription = autoChangeDetectionSubject.subscribe(handler);
|
---|
348 | }
|
---|
349 | /** Allows a `HarnessEnvironment` to stop handling auto change detection status changes. */
|
---|
350 | function stopHandlingAutoChangeDetectionStatus() {
|
---|
351 | autoChangeDetectionSubscription === null || autoChangeDetectionSubscription === void 0 ? void 0 : autoChangeDetectionSubscription.unsubscribe();
|
---|
352 | autoChangeDetectionSubscription = null;
|
---|
353 | }
|
---|
354 | /**
|
---|
355 | * Batches together triggering of change detection over the duration of the given function.
|
---|
356 | * @param fn The function to call with batched change detection.
|
---|
357 | * @param triggerBeforeAndAfter Optionally trigger change detection once before and after the batch
|
---|
358 | * operation. If false, change detection will not be triggered.
|
---|
359 | * @return The result of the given function.
|
---|
360 | */
|
---|
361 | function batchChangeDetection(fn, triggerBeforeAndAfter) {
|
---|
362 | return __awaiter(this, void 0, void 0, function () {
|
---|
363 | return __generator(this, function (_b) {
|
---|
364 | switch (_b.label) {
|
---|
365 | case 0:
|
---|
366 | if (!autoChangeDetectionSubject.getValue().isDisabled) return [3 /*break*/, 2];
|
---|
367 | return [4 /*yield*/, fn()];
|
---|
368 | case 1: return [2 /*return*/, _b.sent()];
|
---|
369 | case 2:
|
---|
370 | // If nothing is handling change detection batching, install the default handler.
|
---|
371 | if (!autoChangeDetectionSubscription) {
|
---|
372 | handleAutoChangeDetectionStatus(defaultAutoChangeDetectionHandler);
|
---|
373 | }
|
---|
374 | if (!triggerBeforeAndAfter) return [3 /*break*/, 9];
|
---|
375 | return [4 /*yield*/, new Promise(function (resolve) { return autoChangeDetectionSubject.next({
|
---|
376 | isDisabled: true,
|
---|
377 | onDetectChangesNow: resolve,
|
---|
378 | }); })];
|
---|
379 | case 3:
|
---|
380 | _b.sent();
|
---|
381 | _b.label = 4;
|
---|
382 | case 4:
|
---|
383 | _b.trys.push([4, , 6, 8]);
|
---|
384 | return [4 /*yield*/, fn()];
|
---|
385 | case 5: return [2 /*return*/, _b.sent()];
|
---|
386 | case 6: return [4 /*yield*/, new Promise(function (resolve) { return autoChangeDetectionSubject.next({
|
---|
387 | isDisabled: false,
|
---|
388 | onDetectChangesNow: resolve,
|
---|
389 | }); })];
|
---|
390 | case 7:
|
---|
391 | _b.sent();
|
---|
392 | return [7 /*endfinally*/];
|
---|
393 | case 8: return [3 /*break*/, 13];
|
---|
394 | case 9:
|
---|
395 | autoChangeDetectionSubject.next({ isDisabled: true });
|
---|
396 | _b.label = 10;
|
---|
397 | case 10:
|
---|
398 | _b.trys.push([10, , 12, 13]);
|
---|
399 | return [4 /*yield*/, fn()];
|
---|
400 | case 11: return [2 /*return*/, _b.sent()];
|
---|
401 | case 12:
|
---|
402 | autoChangeDetectionSubject.next({ isDisabled: false });
|
---|
403 | return [7 /*endfinally*/];
|
---|
404 | case 13: return [2 /*return*/];
|
---|
405 | }
|
---|
406 | });
|
---|
407 | });
|
---|
408 | }
|
---|
409 | /**
|
---|
410 | * Disables the harness system's auto change detection for the duration of the given function.
|
---|
411 | * @param fn The function to disable auto change detection for.
|
---|
412 | * @return The result of the given function.
|
---|
413 | */
|
---|
414 | function manualChangeDetection(fn) {
|
---|
415 | return __awaiter(this, void 0, void 0, function () {
|
---|
416 | return __generator(this, function (_b) {
|
---|
417 | return [2 /*return*/, batchChangeDetection(fn, false)];
|
---|
418 | });
|
---|
419 | });
|
---|
420 | }
|
---|
421 | /**
|
---|
422 | * Resolves the given list of async values in parallel (i.e. via Promise.all) while batching change
|
---|
423 | * detection over the entire operation such that change detection occurs exactly once before
|
---|
424 | * resolving the values and once after.
|
---|
425 | * @param values A getter for the async values to resolve in parallel with batched change detection.
|
---|
426 | * @return The resolved values.
|
---|
427 | */
|
---|
428 | function parallel(values) {
|
---|
429 | return __awaiter(this, void 0, void 0, function () {
|
---|
430 | return __generator(this, function (_b) {
|
---|
431 | return [2 /*return*/, batchChangeDetection(function () { return Promise.all(values()); }, true)];
|
---|
432 | });
|
---|
433 | });
|
---|
434 | }
|
---|
435 |
|
---|
436 | /**
|
---|
437 | * Base class for component harnesses that all component harness authors should extend. This base
|
---|
438 | * component harness provides the basic ability to locate element and sub-component harness. It
|
---|
439 | * should be inherited when defining user's own harness.
|
---|
440 | */
|
---|
441 | var ComponentHarness = /** @class */ (function () {
|
---|
442 | function ComponentHarness(locatorFactory) {
|
---|
443 | this.locatorFactory = locatorFactory;
|
---|
444 | }
|
---|
445 | /** Gets a `Promise` for the `TestElement` representing the host element of the component. */
|
---|
446 | ComponentHarness.prototype.host = function () {
|
---|
447 | return __awaiter(this, void 0, void 0, function () {
|
---|
448 | return __generator(this, function (_b) {
|
---|
449 | return [2 /*return*/, this.locatorFactory.rootElement];
|
---|
450 | });
|
---|
451 | });
|
---|
452 | };
|
---|
453 | /**
|
---|
454 | * Gets a `LocatorFactory` for the document root element. This factory can be used to create
|
---|
455 | * locators for elements that a component creates outside of its own root element. (e.g. by
|
---|
456 | * appending to document.body).
|
---|
457 | */
|
---|
458 | ComponentHarness.prototype.documentRootLocatorFactory = function () {
|
---|
459 | return this.locatorFactory.documentRootLocatorFactory();
|
---|
460 | };
|
---|
461 | /**
|
---|
462 | * Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance
|
---|
463 | * or element under the host element of this `ComponentHarness`.
|
---|
464 | * @param queries A list of queries specifying which harnesses and elements to search for:
|
---|
465 | * - A `string` searches for elements matching the CSS selector specified by the string.
|
---|
466 | * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the
|
---|
467 | * given class.
|
---|
468 | * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given
|
---|
469 | * predicate.
|
---|
470 | * @return An asynchronous locator function that searches for and returns a `Promise` for the
|
---|
471 | * first element or harness matching the given search criteria. Matches are ordered first by
|
---|
472 | * order in the DOM, and second by order in the queries list. If no matches are found, the
|
---|
473 | * `Promise` rejects. The type that the `Promise` resolves to is a union of all result types for
|
---|
474 | * each query.
|
---|
475 | *
|
---|
476 | * e.g. Given the following DOM: `<div id="d1" /><div id="d2" />`, and assuming
|
---|
477 | * `DivHarness.hostSelector === 'div'`:
|
---|
478 | * - `await ch.locatorFor(DivHarness, 'div')()` gets a `DivHarness` instance for `#d1`
|
---|
479 | * - `await ch.locatorFor('div', DivHarness)()` gets a `TestElement` instance for `#d1`
|
---|
480 | * - `await ch.locatorFor('span')()` throws because the `Promise` rejects.
|
---|
481 | */
|
---|
482 | ComponentHarness.prototype.locatorFor = function () {
|
---|
483 | var _b;
|
---|
484 | var queries = [];
|
---|
485 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
486 | queries[_i] = arguments[_i];
|
---|
487 | }
|
---|
488 | return (_b = this.locatorFactory).locatorFor.apply(_b, __spreadArray([], __read(queries)));
|
---|
489 | };
|
---|
490 | /**
|
---|
491 | * Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance
|
---|
492 | * or element under the host element of this `ComponentHarness`.
|
---|
493 | * @param queries A list of queries specifying which harnesses and elements to search for:
|
---|
494 | * - A `string` searches for elements matching the CSS selector specified by the string.
|
---|
495 | * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the
|
---|
496 | * given class.
|
---|
497 | * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given
|
---|
498 | * predicate.
|
---|
499 | * @return An asynchronous locator function that searches for and returns a `Promise` for the
|
---|
500 | * first element or harness matching the given search criteria. Matches are ordered first by
|
---|
501 | * order in the DOM, and second by order in the queries list. If no matches are found, the
|
---|
502 | * `Promise` is resolved with `null`. The type that the `Promise` resolves to is a union of all
|
---|
503 | * result types for each query or null.
|
---|
504 | *
|
---|
505 | * e.g. Given the following DOM: `<div id="d1" /><div id="d2" />`, and assuming
|
---|
506 | * `DivHarness.hostSelector === 'div'`:
|
---|
507 | * - `await ch.locatorForOptional(DivHarness, 'div')()` gets a `DivHarness` instance for `#d1`
|
---|
508 | * - `await ch.locatorForOptional('div', DivHarness)()` gets a `TestElement` instance for `#d1`
|
---|
509 | * - `await ch.locatorForOptional('span')()` gets `null`.
|
---|
510 | */
|
---|
511 | ComponentHarness.prototype.locatorForOptional = function () {
|
---|
512 | var _b;
|
---|
513 | var queries = [];
|
---|
514 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
515 | queries[_i] = arguments[_i];
|
---|
516 | }
|
---|
517 | return (_b = this.locatorFactory).locatorForOptional.apply(_b, __spreadArray([], __read(queries)));
|
---|
518 | };
|
---|
519 | /**
|
---|
520 | * Creates an asynchronous locator function that can be used to find `ComponentHarness` instances
|
---|
521 | * or elements under the host element of this `ComponentHarness`.
|
---|
522 | * @param queries A list of queries specifying which harnesses and elements to search for:
|
---|
523 | * - A `string` searches for elements matching the CSS selector specified by the string.
|
---|
524 | * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the
|
---|
525 | * given class.
|
---|
526 | * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given
|
---|
527 | * predicate.
|
---|
528 | * @return An asynchronous locator function that searches for and returns a `Promise` for all
|
---|
529 | * elements and harnesses matching the given search criteria. Matches are ordered first by
|
---|
530 | * order in the DOM, and second by order in the queries list. If an element matches more than
|
---|
531 | * one `ComponentHarness` class, the locator gets an instance of each for the same element. If
|
---|
532 | * an element matches multiple `string` selectors, only one `TestElement` instance is returned
|
---|
533 | * for that element. The type that the `Promise` resolves to is an array where each element is
|
---|
534 | * the union of all result types for each query.
|
---|
535 | *
|
---|
536 | * e.g. Given the following DOM: `<div id="d1" /><div id="d2" />`, and assuming
|
---|
537 | * `DivHarness.hostSelector === 'div'` and `IdIsD1Harness.hostSelector === '#d1'`:
|
---|
538 | * - `await ch.locatorForAll(DivHarness, 'div')()` gets `[
|
---|
539 | * DivHarness, // for #d1
|
---|
540 | * TestElement, // for #d1
|
---|
541 | * DivHarness, // for #d2
|
---|
542 | * TestElement // for #d2
|
---|
543 | * ]`
|
---|
544 | * - `await ch.locatorForAll('div', '#d1')()` gets `[
|
---|
545 | * TestElement, // for #d1
|
---|
546 | * TestElement // for #d2
|
---|
547 | * ]`
|
---|
548 | * - `await ch.locatorForAll(DivHarness, IdIsD1Harness)()` gets `[
|
---|
549 | * DivHarness, // for #d1
|
---|
550 | * IdIsD1Harness, // for #d1
|
---|
551 | * DivHarness // for #d2
|
---|
552 | * ]`
|
---|
553 | * - `await ch.locatorForAll('span')()` gets `[]`.
|
---|
554 | */
|
---|
555 | ComponentHarness.prototype.locatorForAll = function () {
|
---|
556 | var _b;
|
---|
557 | var queries = [];
|
---|
558 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
559 | queries[_i] = arguments[_i];
|
---|
560 | }
|
---|
561 | return (_b = this.locatorFactory).locatorForAll.apply(_b, __spreadArray([], __read(queries)));
|
---|
562 | };
|
---|
563 | /**
|
---|
564 | * Flushes change detection and async tasks in the Angular zone.
|
---|
565 | * In most cases it should not be necessary to call this manually. However, there may be some edge
|
---|
566 | * cases where it is needed to fully flush animation events.
|
---|
567 | */
|
---|
568 | ComponentHarness.prototype.forceStabilize = function () {
|
---|
569 | return __awaiter(this, void 0, void 0, function () {
|
---|
570 | return __generator(this, function (_b) {
|
---|
571 | return [2 /*return*/, this.locatorFactory.forceStabilize()];
|
---|
572 | });
|
---|
573 | });
|
---|
574 | };
|
---|
575 | /**
|
---|
576 | * Waits for all scheduled or running async tasks to complete. This allows harness
|
---|
577 | * authors to wait for async tasks outside of the Angular zone.
|
---|
578 | */
|
---|
579 | ComponentHarness.prototype.waitForTasksOutsideAngular = function () {
|
---|
580 | return __awaiter(this, void 0, void 0, function () {
|
---|
581 | return __generator(this, function (_b) {
|
---|
582 | return [2 /*return*/, this.locatorFactory.waitForTasksOutsideAngular()];
|
---|
583 | });
|
---|
584 | });
|
---|
585 | };
|
---|
586 | return ComponentHarness;
|
---|
587 | }());
|
---|
588 | /**
|
---|
589 | * Base class for component harnesses that authors should extend if they anticipate that consumers
|
---|
590 | * of the harness may want to access other harnesses within the `<ng-content>` of the component.
|
---|
591 | */
|
---|
592 | var ContentContainerComponentHarness = /** @class */ (function (_super) {
|
---|
593 | __extends(ContentContainerComponentHarness, _super);
|
---|
594 | function ContentContainerComponentHarness() {
|
---|
595 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
596 | }
|
---|
597 | ContentContainerComponentHarness.prototype.getChildLoader = function (selector) {
|
---|
598 | return __awaiter(this, void 0, void 0, function () {
|
---|
599 | return __generator(this, function (_b) {
|
---|
600 | switch (_b.label) {
|
---|
601 | case 0: return [4 /*yield*/, this.getRootHarnessLoader()];
|
---|
602 | case 1: return [2 /*return*/, (_b.sent()).getChildLoader(selector)];
|
---|
603 | }
|
---|
604 | });
|
---|
605 | });
|
---|
606 | };
|
---|
607 | ContentContainerComponentHarness.prototype.getAllChildLoaders = function (selector) {
|
---|
608 | return __awaiter(this, void 0, void 0, function () {
|
---|
609 | return __generator(this, function (_b) {
|
---|
610 | switch (_b.label) {
|
---|
611 | case 0: return [4 /*yield*/, this.getRootHarnessLoader()];
|
---|
612 | case 1: return [2 /*return*/, (_b.sent()).getAllChildLoaders(selector)];
|
---|
613 | }
|
---|
614 | });
|
---|
615 | });
|
---|
616 | };
|
---|
617 | ContentContainerComponentHarness.prototype.getHarness = function (query) {
|
---|
618 | return __awaiter(this, void 0, void 0, function () {
|
---|
619 | return __generator(this, function (_b) {
|
---|
620 | switch (_b.label) {
|
---|
621 | case 0: return [4 /*yield*/, this.getRootHarnessLoader()];
|
---|
622 | case 1: return [2 /*return*/, (_b.sent()).getHarness(query)];
|
---|
623 | }
|
---|
624 | });
|
---|
625 | });
|
---|
626 | };
|
---|
627 | ContentContainerComponentHarness.prototype.getAllHarnesses = function (query) {
|
---|
628 | return __awaiter(this, void 0, void 0, function () {
|
---|
629 | return __generator(this, function (_b) {
|
---|
630 | switch (_b.label) {
|
---|
631 | case 0: return [4 /*yield*/, this.getRootHarnessLoader()];
|
---|
632 | case 1: return [2 /*return*/, (_b.sent()).getAllHarnesses(query)];
|
---|
633 | }
|
---|
634 | });
|
---|
635 | });
|
---|
636 | };
|
---|
637 | /**
|
---|
638 | * Gets the root harness loader from which to start
|
---|
639 | * searching for content contained by this harness.
|
---|
640 | */
|
---|
641 | ContentContainerComponentHarness.prototype.getRootHarnessLoader = function () {
|
---|
642 | return __awaiter(this, void 0, void 0, function () {
|
---|
643 | return __generator(this, function (_b) {
|
---|
644 | return [2 /*return*/, this.locatorFactory.rootHarnessLoader()];
|
---|
645 | });
|
---|
646 | });
|
---|
647 | };
|
---|
648 | return ContentContainerComponentHarness;
|
---|
649 | }(ComponentHarness));
|
---|
650 | /**
|
---|
651 | * A class used to associate a ComponentHarness class with predicates functions that can be used to
|
---|
652 | * filter instances of the class.
|
---|
653 | */
|
---|
654 | var HarnessPredicate = /** @class */ (function () {
|
---|
655 | function HarnessPredicate(harnessType, options) {
|
---|
656 | this.harnessType = harnessType;
|
---|
657 | this._predicates = [];
|
---|
658 | this._descriptions = [];
|
---|
659 | this._addBaseOptions(options);
|
---|
660 | }
|
---|
661 | /**
|
---|
662 | * Checks if the specified nullable string value matches the given pattern.
|
---|
663 | * @param value The nullable string value to check, or a Promise resolving to the
|
---|
664 | * nullable string value.
|
---|
665 | * @param pattern The pattern the value is expected to match. If `pattern` is a string,
|
---|
666 | * `value` is expected to match exactly. If `pattern` is a regex, a partial match is
|
---|
667 | * allowed. If `pattern` is `null`, the value is expected to be `null`.
|
---|
668 | * @return Whether the value matches the pattern.
|
---|
669 | */
|
---|
670 | HarnessPredicate.stringMatches = function (value, pattern) {
|
---|
671 | return __awaiter(this, void 0, void 0, function () {
|
---|
672 | return __generator(this, function (_b) {
|
---|
673 | switch (_b.label) {
|
---|
674 | case 0: return [4 /*yield*/, value];
|
---|
675 | case 1:
|
---|
676 | value = _b.sent();
|
---|
677 | if (pattern === null) {
|
---|
678 | return [2 /*return*/, value === null];
|
---|
679 | }
|
---|
680 | else if (value === null) {
|
---|
681 | return [2 /*return*/, false];
|
---|
682 | }
|
---|
683 | return [2 /*return*/, typeof pattern === 'string' ? value === pattern : pattern.test(value)];
|
---|
684 | }
|
---|
685 | });
|
---|
686 | });
|
---|
687 | };
|
---|
688 | /**
|
---|
689 | * Adds a predicate function to be run against candidate harnesses.
|
---|
690 | * @param description A description of this predicate that may be used in error messages.
|
---|
691 | * @param predicate An async predicate function.
|
---|
692 | * @return this (for method chaining).
|
---|
693 | */
|
---|
694 | HarnessPredicate.prototype.add = function (description, predicate) {
|
---|
695 | this._descriptions.push(description);
|
---|
696 | this._predicates.push(predicate);
|
---|
697 | return this;
|
---|
698 | };
|
---|
699 | /**
|
---|
700 | * Adds a predicate function that depends on an option value to be run against candidate
|
---|
701 | * harnesses. If the option value is undefined, the predicate will be ignored.
|
---|
702 | * @param name The name of the option (may be used in error messages).
|
---|
703 | * @param option The option value.
|
---|
704 | * @param predicate The predicate function to run if the option value is not undefined.
|
---|
705 | * @return this (for method chaining).
|
---|
706 | */
|
---|
707 | HarnessPredicate.prototype.addOption = function (name, option, predicate) {
|
---|
708 | if (option !== undefined) {
|
---|
709 | this.add(name + " = " + _valueAsString(option), function (item) { return predicate(item, option); });
|
---|
710 | }
|
---|
711 | return this;
|
---|
712 | };
|
---|
713 | /**
|
---|
714 | * Filters a list of harnesses on this predicate.
|
---|
715 | * @param harnesses The list of harnesses to filter.
|
---|
716 | * @return A list of harnesses that satisfy this predicate.
|
---|
717 | */
|
---|
718 | HarnessPredicate.prototype.filter = function (harnesses) {
|
---|
719 | return __awaiter(this, void 0, void 0, function () {
|
---|
720 | var results;
|
---|
721 | var _this = this;
|
---|
722 | return __generator(this, function (_b) {
|
---|
723 | switch (_b.label) {
|
---|
724 | case 0:
|
---|
725 | if (harnesses.length === 0) {
|
---|
726 | return [2 /*return*/, []];
|
---|
727 | }
|
---|
728 | return [4 /*yield*/, parallel(function () { return harnesses.map(function (h) { return _this.evaluate(h); }); })];
|
---|
729 | case 1:
|
---|
730 | results = _b.sent();
|
---|
731 | return [2 /*return*/, harnesses.filter(function (_, i) { return results[i]; })];
|
---|
732 | }
|
---|
733 | });
|
---|
734 | });
|
---|
735 | };
|
---|
736 | /**
|
---|
737 | * Evaluates whether the given harness satisfies this predicate.
|
---|
738 | * @param harness The harness to check
|
---|
739 | * @return A promise that resolves to true if the harness satisfies this predicate,
|
---|
740 | * and resolves to false otherwise.
|
---|
741 | */
|
---|
742 | HarnessPredicate.prototype.evaluate = function (harness) {
|
---|
743 | return __awaiter(this, void 0, void 0, function () {
|
---|
744 | var results;
|
---|
745 | var _this = this;
|
---|
746 | return __generator(this, function (_b) {
|
---|
747 | switch (_b.label) {
|
---|
748 | case 0: return [4 /*yield*/, parallel(function () { return _this._predicates.map(function (p) { return p(harness); }); })];
|
---|
749 | case 1:
|
---|
750 | results = _b.sent();
|
---|
751 | return [2 /*return*/, results.reduce(function (combined, current) { return combined && current; }, true)];
|
---|
752 | }
|
---|
753 | });
|
---|
754 | });
|
---|
755 | };
|
---|
756 | /** Gets a description of this predicate for use in error messages. */
|
---|
757 | HarnessPredicate.prototype.getDescription = function () {
|
---|
758 | return this._descriptions.join(', ');
|
---|
759 | };
|
---|
760 | /** Gets the selector used to find candidate elements. */
|
---|
761 | HarnessPredicate.prototype.getSelector = function () {
|
---|
762 | // We don't have to go through the extra trouble if there are no ancestors.
|
---|
763 | if (!this._ancestor) {
|
---|
764 | return (this.harnessType.hostSelector || '').trim();
|
---|
765 | }
|
---|
766 | var _b = __read(_splitAndEscapeSelector(this._ancestor), 2), ancestors = _b[0], ancestorPlaceholders = _b[1];
|
---|
767 | var _c = __read(_splitAndEscapeSelector(this.harnessType.hostSelector || ''), 2), selectors = _c[0], selectorPlaceholders = _c[1];
|
---|
768 | var result = [];
|
---|
769 | // We have to add the ancestor to each part of the host compound selector, otherwise we can get
|
---|
770 | // incorrect results. E.g. `.ancestor .a, .ancestor .b` vs `.ancestor .a, .b`.
|
---|
771 | ancestors.forEach(function (escapedAncestor) {
|
---|
772 | var ancestor = _restoreSelector(escapedAncestor, ancestorPlaceholders);
|
---|
773 | return selectors.forEach(function (escapedSelector) { return result.push(ancestor + " " + _restoreSelector(escapedSelector, selectorPlaceholders)); });
|
---|
774 | });
|
---|
775 | return result.join(', ');
|
---|
776 | };
|
---|
777 | /** Adds base options common to all harness types. */
|
---|
778 | HarnessPredicate.prototype._addBaseOptions = function (options) {
|
---|
779 | var _this = this;
|
---|
780 | this._ancestor = options.ancestor || '';
|
---|
781 | if (this._ancestor) {
|
---|
782 | this._descriptions.push("has ancestor matching selector \"" + this._ancestor + "\"");
|
---|
783 | }
|
---|
784 | var selector = options.selector;
|
---|
785 | if (selector !== undefined) {
|
---|
786 | this.add("host matches selector \"" + selector + "\"", function (item) { return __awaiter(_this, void 0, void 0, function () {
|
---|
787 | return __generator(this, function (_b) {
|
---|
788 | switch (_b.label) {
|
---|
789 | case 0: return [4 /*yield*/, item.host()];
|
---|
790 | case 1: return [2 /*return*/, (_b.sent()).matchesSelector(selector)];
|
---|
791 | }
|
---|
792 | });
|
---|
793 | }); });
|
---|
794 | }
|
---|
795 | };
|
---|
796 | return HarnessPredicate;
|
---|
797 | }());
|
---|
798 | /** Represent a value as a string for the purpose of logging. */
|
---|
799 | function _valueAsString(value) {
|
---|
800 | if (value === undefined) {
|
---|
801 | return 'undefined';
|
---|
802 | }
|
---|
803 | try {
|
---|
804 | // `JSON.stringify` doesn't handle RegExp properly, so we need a custom replacer.
|
---|
805 | // Use a character that is unlikely to appear in real strings to denote the start and end of
|
---|
806 | // the regex. This allows us to strip out the extra quotes around the value added by
|
---|
807 | // `JSON.stringify`. Also do custom escaping on `"` characters to prevent `JSON.stringify`
|
---|
808 | // from escaping them as if they were part of a string.
|
---|
809 | var stringifiedValue = JSON.stringify(value, function (_, v) { return v instanceof RegExp ?
|
---|
810 | "\u25ECMAT_RE_ESCAPE\u25EC" + v.toString().replace(/"/g, '◬MAT_RE_ESCAPE◬') + "\u25ECMAT_RE_ESCAPE\u25EC" : v; });
|
---|
811 | // Strip out the extra quotes around regexes and put back the manually escaped `"` characters.
|
---|
812 | return stringifiedValue
|
---|
813 | .replace(/"◬MAT_RE_ESCAPE◬|◬MAT_RE_ESCAPE◬"/g, '')
|
---|
814 | .replace(/◬MAT_RE_ESCAPE◬/g, '"');
|
---|
815 | }
|
---|
816 | catch (_a) {
|
---|
817 | // `JSON.stringify` will throw if the object is cyclical,
|
---|
818 | // in this case the best we can do is report the value as `{...}`.
|
---|
819 | return '{...}';
|
---|
820 | }
|
---|
821 | }
|
---|
822 | /**
|
---|
823 | * Splits up a compound selector into its parts and escapes any quoted content. The quoted content
|
---|
824 | * has to be escaped, because it can contain commas which will throw throw us off when trying to
|
---|
825 | * split it.
|
---|
826 | * @param selector Selector to be split.
|
---|
827 | * @returns The escaped string where any quoted content is replaced with a placeholder. E.g.
|
---|
828 | * `[foo="bar"]` turns into `[foo=__cdkPlaceholder-0__]`. Use `_restoreSelector` to restore
|
---|
829 | * the placeholders.
|
---|
830 | */
|
---|
831 | function _splitAndEscapeSelector(selector) {
|
---|
832 | var placeholders = [];
|
---|
833 | // Note that the regex doesn't account for nested quotes so something like `"ab'cd'e"` will be
|
---|
834 | // considered as two blocks. It's a bit of an edge case, but if we find that it's a problem,
|
---|
835 | // we can make it a bit smarter using a loop. Use this for now since it's more readable and
|
---|
836 | // compact. More complete implementation:
|
---|
837 | // https://github.com/angular/angular/blob/bd34bc9e89f18a/packages/compiler/src/shadow_css.ts#L655
|
---|
838 | var result = selector.replace(/(["'][^["']*["'])/g, function (_, keep) {
|
---|
839 | var replaceBy = "__cdkPlaceholder-" + placeholders.length + "__";
|
---|
840 | placeholders.push(keep);
|
---|
841 | return replaceBy;
|
---|
842 | });
|
---|
843 | return [result.split(',').map(function (part) { return part.trim(); }), placeholders];
|
---|
844 | }
|
---|
845 | /** Restores a selector whose content was escaped in `_splitAndEscapeSelector`. */
|
---|
846 | function _restoreSelector(selector, placeholders) {
|
---|
847 | return selector.replace(/__cdkPlaceholder-(\d+)__/g, function (_, index) { return placeholders[+index]; });
|
---|
848 | }
|
---|
849 |
|
---|
850 | /**
|
---|
851 | * Base harness environment class that can be extended to allow `ComponentHarness`es to be used in
|
---|
852 | * different test environments (e.g. testbed, protractor, etc.). This class implements the
|
---|
853 | * functionality of both a `HarnessLoader` and `LocatorFactory`. This class is generic on the raw
|
---|
854 | * element type, `E`, used by the particular test environment.
|
---|
855 | */
|
---|
856 | var HarnessEnvironment = /** @class */ (function () {
|
---|
857 | function HarnessEnvironment(rawRootElement) {
|
---|
858 | this.rawRootElement = rawRootElement;
|
---|
859 | this.rootElement = this.createTestElement(rawRootElement);
|
---|
860 | }
|
---|
861 | // Implemented as part of the `LocatorFactory` interface.
|
---|
862 | HarnessEnvironment.prototype.documentRootLocatorFactory = function () {
|
---|
863 | return this.createEnvironment(this.getDocumentRoot());
|
---|
864 | };
|
---|
865 | // Implemented as part of the `LocatorFactory` interface.
|
---|
866 | HarnessEnvironment.prototype.locatorFor = function () {
|
---|
867 | var _this = this;
|
---|
868 | var queries = [];
|
---|
869 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
870 | queries[_i] = arguments[_i];
|
---|
871 | }
|
---|
872 | return function () { return _assertResultFound(_this._getAllHarnessesAndTestElements(queries), _getDescriptionForLocatorForQueries(queries)); };
|
---|
873 | };
|
---|
874 | // Implemented as part of the `LocatorFactory` interface.
|
---|
875 | HarnessEnvironment.prototype.locatorForOptional = function () {
|
---|
876 | var _this = this;
|
---|
877 | var queries = [];
|
---|
878 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
879 | queries[_i] = arguments[_i];
|
---|
880 | }
|
---|
881 | return function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
---|
882 | switch (_a.label) {
|
---|
883 | case 0: return [4 /*yield*/, this._getAllHarnessesAndTestElements(queries)];
|
---|
884 | case 1: return [2 /*return*/, (_a.sent())[0] || null];
|
---|
885 | }
|
---|
886 | }); }); };
|
---|
887 | };
|
---|
888 | // Implemented as part of the `LocatorFactory` interface.
|
---|
889 | HarnessEnvironment.prototype.locatorForAll = function () {
|
---|
890 | var _this = this;
|
---|
891 | var queries = [];
|
---|
892 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
893 | queries[_i] = arguments[_i];
|
---|
894 | }
|
---|
895 | return function () { return _this._getAllHarnessesAndTestElements(queries); };
|
---|
896 | };
|
---|
897 | // Implemented as part of the `LocatorFactory` interface.
|
---|
898 | HarnessEnvironment.prototype.rootHarnessLoader = function () {
|
---|
899 | return __awaiter(this, void 0, void 0, function () {
|
---|
900 | return __generator(this, function (_a) {
|
---|
901 | return [2 /*return*/, this];
|
---|
902 | });
|
---|
903 | });
|
---|
904 | };
|
---|
905 | // Implemented as part of the `LocatorFactory` interface.
|
---|
906 | HarnessEnvironment.prototype.harnessLoaderFor = function (selector) {
|
---|
907 | return __awaiter(this, void 0, void 0, function () {
|
---|
908 | var _a;
|
---|
909 | return __generator(this, function (_b) {
|
---|
910 | switch (_b.label) {
|
---|
911 | case 0:
|
---|
912 | _a = this.createEnvironment;
|
---|
913 | return [4 /*yield*/, _assertResultFound(this.getAllRawElements(selector), [_getDescriptionForHarnessLoaderQuery(selector)])];
|
---|
914 | case 1: return [2 /*return*/, _a.apply(this, [_b.sent()])];
|
---|
915 | }
|
---|
916 | });
|
---|
917 | });
|
---|
918 | };
|
---|
919 | // Implemented as part of the `LocatorFactory` interface.
|
---|
920 | HarnessEnvironment.prototype.harnessLoaderForOptional = function (selector) {
|
---|
921 | return __awaiter(this, void 0, void 0, function () {
|
---|
922 | var elements;
|
---|
923 | return __generator(this, function (_a) {
|
---|
924 | switch (_a.label) {
|
---|
925 | case 0: return [4 /*yield*/, this.getAllRawElements(selector)];
|
---|
926 | case 1:
|
---|
927 | elements = _a.sent();
|
---|
928 | return [2 /*return*/, elements[0] ? this.createEnvironment(elements[0]) : null];
|
---|
929 | }
|
---|
930 | });
|
---|
931 | });
|
---|
932 | };
|
---|
933 | // Implemented as part of the `LocatorFactory` interface.
|
---|
934 | HarnessEnvironment.prototype.harnessLoaderForAll = function (selector) {
|
---|
935 | return __awaiter(this, void 0, void 0, function () {
|
---|
936 | var elements;
|
---|
937 | var _this = this;
|
---|
938 | return __generator(this, function (_a) {
|
---|
939 | switch (_a.label) {
|
---|
940 | case 0: return [4 /*yield*/, this.getAllRawElements(selector)];
|
---|
941 | case 1:
|
---|
942 | elements = _a.sent();
|
---|
943 | return [2 /*return*/, elements.map(function (element) { return _this.createEnvironment(element); })];
|
---|
944 | }
|
---|
945 | });
|
---|
946 | });
|
---|
947 | };
|
---|
948 | // Implemented as part of the `HarnessLoader` interface.
|
---|
949 | HarnessEnvironment.prototype.getHarness = function (query) {
|
---|
950 | return this.locatorFor(query)();
|
---|
951 | };
|
---|
952 | // Implemented as part of the `HarnessLoader` interface.
|
---|
953 | HarnessEnvironment.prototype.getAllHarnesses = function (query) {
|
---|
954 | return this.locatorForAll(query)();
|
---|
955 | };
|
---|
956 | // Implemented as part of the `HarnessLoader` interface.
|
---|
957 | HarnessEnvironment.prototype.getChildLoader = function (selector) {
|
---|
958 | return __awaiter(this, void 0, void 0, function () {
|
---|
959 | var _a;
|
---|
960 | return __generator(this, function (_b) {
|
---|
961 | switch (_b.label) {
|
---|
962 | case 0:
|
---|
963 | _a = this.createEnvironment;
|
---|
964 | return [4 /*yield*/, _assertResultFound(this.getAllRawElements(selector), [_getDescriptionForHarnessLoaderQuery(selector)])];
|
---|
965 | case 1: return [2 /*return*/, _a.apply(this, [_b.sent()])];
|
---|
966 | }
|
---|
967 | });
|
---|
968 | });
|
---|
969 | };
|
---|
970 | // Implemented as part of the `HarnessLoader` interface.
|
---|
971 | HarnessEnvironment.prototype.getAllChildLoaders = function (selector) {
|
---|
972 | return __awaiter(this, void 0, void 0, function () {
|
---|
973 | var _this = this;
|
---|
974 | return __generator(this, function (_a) {
|
---|
975 | switch (_a.label) {
|
---|
976 | case 0: return [4 /*yield*/, this.getAllRawElements(selector)];
|
---|
977 | case 1: return [2 /*return*/, (_a.sent()).map(function (e) { return _this.createEnvironment(e); })];
|
---|
978 | }
|
---|
979 | });
|
---|
980 | });
|
---|
981 | };
|
---|
982 | /** Creates a `ComponentHarness` for the given harness type with the given raw host element. */
|
---|
983 | HarnessEnvironment.prototype.createComponentHarness = function (harnessType, element) {
|
---|
984 | return new harnessType(this.createEnvironment(element));
|
---|
985 | };
|
---|
986 | /**
|
---|
987 | * Matches the given raw elements with the given list of element and harness queries to produce a
|
---|
988 | * list of matched harnesses and test elements.
|
---|
989 | */
|
---|
990 | HarnessEnvironment.prototype._getAllHarnessesAndTestElements = function (queries) {
|
---|
991 | return __awaiter(this, void 0, void 0, function () {
|
---|
992 | var _a, allQueries, harnessQueries, elementQueries, harnessTypes, rawElements, skipSelectorCheck, perElementMatches;
|
---|
993 | var _this = this;
|
---|
994 | return __generator(this, function (_b) {
|
---|
995 | switch (_b.label) {
|
---|
996 | case 0:
|
---|
997 | _a = _parseQueries(queries), allQueries = _a.allQueries, harnessQueries = _a.harnessQueries, elementQueries = _a.elementQueries, harnessTypes = _a.harnessTypes;
|
---|
998 | return [4 /*yield*/, this.getAllRawElements(__spreadArray(__spreadArray([], __read(elementQueries)), __read(harnessQueries.map(function (predicate) { return predicate.getSelector(); }))).join(','))];
|
---|
999 | case 1:
|
---|
1000 | rawElements = _b.sent();
|
---|
1001 | skipSelectorCheck = (elementQueries.length === 0 && harnessTypes.size === 1) ||
|
---|
1002 | harnessQueries.length === 0;
|
---|
1003 | return [4 /*yield*/, parallel(function () { return rawElements.map(function (rawElement) { return __awaiter(_this, void 0, void 0, function () {
|
---|
1004 | var testElement, allResultsForElement;
|
---|
1005 | var _this = this;
|
---|
1006 | return __generator(this, function (_a) {
|
---|
1007 | switch (_a.label) {
|
---|
1008 | case 0:
|
---|
1009 | testElement = this.createTestElement(rawElement);
|
---|
1010 | return [4 /*yield*/, parallel(
|
---|
1011 | // For each query, get `null` if it doesn't match, or a `TestElement` or
|
---|
1012 | // `ComponentHarness` as appropriate if it does match. This gives us everything that
|
---|
1013 | // matches the current raw element, but it may contain duplicate entries (e.g.
|
---|
1014 | // multiple `TestElement` or multiple `ComponentHarness` of the same type).
|
---|
1015 | function () { return allQueries.map(function (query) { return _this._getQueryResultForElement(query, rawElement, testElement, skipSelectorCheck); }); })];
|
---|
1016 | case 1:
|
---|
1017 | allResultsForElement = _a.sent();
|
---|
1018 | return [2 /*return*/, _removeDuplicateQueryResults(allResultsForElement)];
|
---|
1019 | }
|
---|
1020 | });
|
---|
1021 | }); }); })];
|
---|
1022 | case 2:
|
---|
1023 | perElementMatches = _b.sent();
|
---|
1024 | return [2 /*return*/, [].concat.apply([], __spreadArray([], __read(perElementMatches)))];
|
---|
1025 | }
|
---|
1026 | });
|
---|
1027 | });
|
---|
1028 | };
|
---|
1029 | /**
|
---|
1030 | * Check whether the given query matches the given element, if it does return the matched
|
---|
1031 | * `TestElement` or `ComponentHarness`, if it does not, return null. In cases where the caller
|
---|
1032 | * knows for sure that the query matches the element's selector, `skipSelectorCheck` can be used
|
---|
1033 | * to skip verification and optimize performance.
|
---|
1034 | */
|
---|
1035 | HarnessEnvironment.prototype._getQueryResultForElement = function (query, rawElement, testElement, skipSelectorCheck) {
|
---|
1036 | if (skipSelectorCheck === void 0) { skipSelectorCheck = false; }
|
---|
1037 | return __awaiter(this, void 0, void 0, function () {
|
---|
1038 | var _a, _b, harness;
|
---|
1039 | return __generator(this, function (_c) {
|
---|
1040 | switch (_c.label) {
|
---|
1041 | case 0:
|
---|
1042 | if (!(typeof query === 'string')) return [3 /*break*/, 3];
|
---|
1043 | _a = skipSelectorCheck;
|
---|
1044 | if (_a) return [3 /*break*/, 2];
|
---|
1045 | return [4 /*yield*/, testElement.matchesSelector(query)];
|
---|
1046 | case 1:
|
---|
1047 | _a = (_c.sent());
|
---|
1048 | _c.label = 2;
|
---|
1049 | case 2: return [2 /*return*/, ((_a) ? testElement : null)];
|
---|
1050 | case 3:
|
---|
1051 | _b = skipSelectorCheck;
|
---|
1052 | if (_b) return [3 /*break*/, 5];
|
---|
1053 | return [4 /*yield*/, testElement.matchesSelector(query.getSelector())];
|
---|
1054 | case 4:
|
---|
1055 | _b = (_c.sent());
|
---|
1056 | _c.label = 5;
|
---|
1057 | case 5:
|
---|
1058 | if (!_b) return [3 /*break*/, 7];
|
---|
1059 | harness = this.createComponentHarness(query.harnessType, rawElement);
|
---|
1060 | return [4 /*yield*/, query.evaluate(harness)];
|
---|
1061 | case 6: return [2 /*return*/, (_c.sent()) ? harness : null];
|
---|
1062 | case 7: return [2 /*return*/, null];
|
---|
1063 | }
|
---|
1064 | });
|
---|
1065 | });
|
---|
1066 | };
|
---|
1067 | return HarnessEnvironment;
|
---|
1068 | }());
|
---|
1069 | /**
|
---|
1070 | * Parses a list of queries in the format accepted by the `locatorFor*` methods into an easier to
|
---|
1071 | * work with format.
|
---|
1072 | */
|
---|
1073 | function _parseQueries(queries) {
|
---|
1074 | var e_1, _a;
|
---|
1075 | var allQueries = [];
|
---|
1076 | var harnessQueries = [];
|
---|
1077 | var elementQueries = [];
|
---|
1078 | var harnessTypes = new Set();
|
---|
1079 | try {
|
---|
1080 | for (var queries_1 = __values(queries), queries_1_1 = queries_1.next(); !queries_1_1.done; queries_1_1 = queries_1.next()) {
|
---|
1081 | var query = queries_1_1.value;
|
---|
1082 | if (typeof query === 'string') {
|
---|
1083 | allQueries.push(query);
|
---|
1084 | elementQueries.push(query);
|
---|
1085 | }
|
---|
1086 | else {
|
---|
1087 | var predicate = query instanceof HarnessPredicate ? query : new HarnessPredicate(query, {});
|
---|
1088 | allQueries.push(predicate);
|
---|
1089 | harnessQueries.push(predicate);
|
---|
1090 | harnessTypes.add(predicate.harnessType);
|
---|
1091 | }
|
---|
1092 | }
|
---|
1093 | }
|
---|
1094 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
---|
1095 | finally {
|
---|
1096 | try {
|
---|
1097 | if (queries_1_1 && !queries_1_1.done && (_a = queries_1.return)) _a.call(queries_1);
|
---|
1098 | }
|
---|
1099 | finally { if (e_1) throw e_1.error; }
|
---|
1100 | }
|
---|
1101 | return { allQueries: allQueries, harnessQueries: harnessQueries, elementQueries: elementQueries, harnessTypes: harnessTypes };
|
---|
1102 | }
|
---|
1103 | /**
|
---|
1104 | * Removes duplicate query results for a particular element. (e.g. multiple `TestElement`
|
---|
1105 | * instances or multiple instances of the same `ComponentHarness` class.
|
---|
1106 | */
|
---|
1107 | function _removeDuplicateQueryResults(results) {
|
---|
1108 | return __awaiter(this, void 0, void 0, function () {
|
---|
1109 | var testElementMatched, matchedHarnessTypes, dedupedMatches, results_1, results_1_1, result;
|
---|
1110 | var e_2, _a;
|
---|
1111 | return __generator(this, function (_b) {
|
---|
1112 | testElementMatched = false;
|
---|
1113 | matchedHarnessTypes = new Set();
|
---|
1114 | dedupedMatches = [];
|
---|
1115 | try {
|
---|
1116 | for (results_1 = __values(results), results_1_1 = results_1.next(); !results_1_1.done; results_1_1 = results_1.next()) {
|
---|
1117 | result = results_1_1.value;
|
---|
1118 | if (!result) {
|
---|
1119 | continue;
|
---|
1120 | }
|
---|
1121 | if (result instanceof ComponentHarness) {
|
---|
1122 | if (!matchedHarnessTypes.has(result.constructor)) {
|
---|
1123 | matchedHarnessTypes.add(result.constructor);
|
---|
1124 | dedupedMatches.push(result);
|
---|
1125 | }
|
---|
1126 | }
|
---|
1127 | else if (!testElementMatched) {
|
---|
1128 | testElementMatched = true;
|
---|
1129 | dedupedMatches.push(result);
|
---|
1130 | }
|
---|
1131 | }
|
---|
1132 | }
|
---|
1133 | catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
---|
1134 | finally {
|
---|
1135 | try {
|
---|
1136 | if (results_1_1 && !results_1_1.done && (_a = results_1.return)) _a.call(results_1);
|
---|
1137 | }
|
---|
1138 | finally { if (e_2) throw e_2.error; }
|
---|
1139 | }
|
---|
1140 | return [2 /*return*/, dedupedMatches];
|
---|
1141 | });
|
---|
1142 | });
|
---|
1143 | }
|
---|
1144 | /** Verifies that there is at least one result in an array. */
|
---|
1145 | function _assertResultFound(results, queryDescriptions) {
|
---|
1146 | return __awaiter(this, void 0, void 0, function () {
|
---|
1147 | var result;
|
---|
1148 | return __generator(this, function (_a) {
|
---|
1149 | switch (_a.label) {
|
---|
1150 | case 0: return [4 /*yield*/, results];
|
---|
1151 | case 1:
|
---|
1152 | result = (_a.sent())[0];
|
---|
1153 | if (result == undefined) {
|
---|
1154 | throw Error("Failed to find element matching one of the following queries:\n" +
|
---|
1155 | queryDescriptions.map(function (desc) { return "(" + desc + ")"; }).join(',\n'));
|
---|
1156 | }
|
---|
1157 | return [2 /*return*/, result];
|
---|
1158 | }
|
---|
1159 | });
|
---|
1160 | });
|
---|
1161 | }
|
---|
1162 | /** Gets a list of description strings from a list of queries. */
|
---|
1163 | function _getDescriptionForLocatorForQueries(queries) {
|
---|
1164 | return queries.map(function (query) { return typeof query === 'string' ?
|
---|
1165 | _getDescriptionForTestElementQuery(query) : _getDescriptionForComponentHarnessQuery(query); });
|
---|
1166 | }
|
---|
1167 | /** Gets a description string for a `ComponentHarness` query. */
|
---|
1168 | function _getDescriptionForComponentHarnessQuery(query) {
|
---|
1169 | var harnessPredicate = query instanceof HarnessPredicate ? query : new HarnessPredicate(query, {});
|
---|
1170 | var _a = harnessPredicate.harnessType, name = _a.name, hostSelector = _a.hostSelector;
|
---|
1171 | var description = name + " with host element matching selector: \"" + hostSelector + "\"";
|
---|
1172 | var constraints = harnessPredicate.getDescription();
|
---|
1173 | return description + (constraints ?
|
---|
1174 | " satisfying the constraints: " + harnessPredicate.getDescription() : '');
|
---|
1175 | }
|
---|
1176 | /** Gets a description string for a `TestElement` query. */
|
---|
1177 | function _getDescriptionForTestElementQuery(selector) {
|
---|
1178 | return "TestElement for element matching selector: \"" + selector + "\"";
|
---|
1179 | }
|
---|
1180 | /** Gets a description string for a `HarnessLoader` query. */
|
---|
1181 | function _getDescriptionForHarnessLoaderQuery(selector) {
|
---|
1182 | return "HarnessLoader for element matching selector: \"" + selector + "\"";
|
---|
1183 | }
|
---|
1184 |
|
---|
1185 | /**
|
---|
1186 | * @license
|
---|
1187 | * Copyright Google LLC All Rights Reserved.
|
---|
1188 | *
|
---|
1189 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1190 | * found in the LICENSE file at https://angular.io/license
|
---|
1191 | */
|
---|
1192 | /** An enum of non-text keys that can be used with the `sendKeys` method. */
|
---|
1193 | // NOTE: This is a separate enum from `@angular/cdk/keycodes` because we don't necessarily want to
|
---|
1194 | // support every possible keyCode. We also can't rely on Protractor's `Key` because we don't want a
|
---|
1195 | // dependency on any particular testing framework here. Instead we'll just maintain this supported
|
---|
1196 | // list of keys and let individual concrete `HarnessEnvironment` classes map them to whatever key
|
---|
1197 | // representation is used in its respective testing framework.
|
---|
1198 | // tslint:disable-next-line:prefer-const-enum Seems like this causes some issues with System.js
|
---|
1199 | exports.TestKey = void 0;
|
---|
1200 | (function (TestKey) {
|
---|
1201 | TestKey[TestKey["BACKSPACE"] = 0] = "BACKSPACE";
|
---|
1202 | TestKey[TestKey["TAB"] = 1] = "TAB";
|
---|
1203 | TestKey[TestKey["ENTER"] = 2] = "ENTER";
|
---|
1204 | TestKey[TestKey["SHIFT"] = 3] = "SHIFT";
|
---|
1205 | TestKey[TestKey["CONTROL"] = 4] = "CONTROL";
|
---|
1206 | TestKey[TestKey["ALT"] = 5] = "ALT";
|
---|
1207 | TestKey[TestKey["ESCAPE"] = 6] = "ESCAPE";
|
---|
1208 | TestKey[TestKey["PAGE_UP"] = 7] = "PAGE_UP";
|
---|
1209 | TestKey[TestKey["PAGE_DOWN"] = 8] = "PAGE_DOWN";
|
---|
1210 | TestKey[TestKey["END"] = 9] = "END";
|
---|
1211 | TestKey[TestKey["HOME"] = 10] = "HOME";
|
---|
1212 | TestKey[TestKey["LEFT_ARROW"] = 11] = "LEFT_ARROW";
|
---|
1213 | TestKey[TestKey["UP_ARROW"] = 12] = "UP_ARROW";
|
---|
1214 | TestKey[TestKey["RIGHT_ARROW"] = 13] = "RIGHT_ARROW";
|
---|
1215 | TestKey[TestKey["DOWN_ARROW"] = 14] = "DOWN_ARROW";
|
---|
1216 | TestKey[TestKey["INSERT"] = 15] = "INSERT";
|
---|
1217 | TestKey[TestKey["DELETE"] = 16] = "DELETE";
|
---|
1218 | TestKey[TestKey["F1"] = 17] = "F1";
|
---|
1219 | TestKey[TestKey["F2"] = 18] = "F2";
|
---|
1220 | TestKey[TestKey["F3"] = 19] = "F3";
|
---|
1221 | TestKey[TestKey["F4"] = 20] = "F4";
|
---|
1222 | TestKey[TestKey["F5"] = 21] = "F5";
|
---|
1223 | TestKey[TestKey["F6"] = 22] = "F6";
|
---|
1224 | TestKey[TestKey["F7"] = 23] = "F7";
|
---|
1225 | TestKey[TestKey["F8"] = 24] = "F8";
|
---|
1226 | TestKey[TestKey["F9"] = 25] = "F9";
|
---|
1227 | TestKey[TestKey["F10"] = 26] = "F10";
|
---|
1228 | TestKey[TestKey["F11"] = 27] = "F11";
|
---|
1229 | TestKey[TestKey["F12"] = 28] = "F12";
|
---|
1230 | TestKey[TestKey["META"] = 29] = "META";
|
---|
1231 | })(exports.TestKey || (exports.TestKey = {}));
|
---|
1232 |
|
---|
1233 | /**
|
---|
1234 | * @license
|
---|
1235 | * Copyright Google LLC All Rights Reserved.
|
---|
1236 | *
|
---|
1237 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1238 | * found in the LICENSE file at https://angular.io/license
|
---|
1239 | */
|
---|
1240 | /**
|
---|
1241 | * Gets text of element excluding certain selectors within the element.
|
---|
1242 | * @param element Element to get text from,
|
---|
1243 | * @param excludeSelector Selector identifying which elements to exclude,
|
---|
1244 | */
|
---|
1245 | function _getTextWithExcludedElements(element, excludeSelector) {
|
---|
1246 | var _a;
|
---|
1247 | var clone = element.cloneNode(true);
|
---|
1248 | var exclusions = clone.querySelectorAll(excludeSelector);
|
---|
1249 | for (var i = 0; i < exclusions.length; i++) {
|
---|
1250 | var child = exclusions[i];
|
---|
1251 | (_a = child.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(child);
|
---|
1252 | }
|
---|
1253 | return (clone.textContent || '').trim();
|
---|
1254 | }
|
---|
1255 |
|
---|
1256 | /**
|
---|
1257 | * @license
|
---|
1258 | * Copyright Google LLC All Rights Reserved.
|
---|
1259 | *
|
---|
1260 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1261 | * found in the LICENSE file at https://angular.io/license
|
---|
1262 | */
|
---|
1263 |
|
---|
1264 | /**
|
---|
1265 | * @license
|
---|
1266 | * Copyright Google LLC All Rights Reserved.
|
---|
1267 | *
|
---|
1268 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1269 | * found in the LICENSE file at https://angular.io/license
|
---|
1270 | */
|
---|
1271 |
|
---|
1272 | exports.ComponentHarness = ComponentHarness;
|
---|
1273 | exports.ContentContainerComponentHarness = ContentContainerComponentHarness;
|
---|
1274 | exports.HarnessEnvironment = HarnessEnvironment;
|
---|
1275 | exports.HarnessPredicate = HarnessPredicate;
|
---|
1276 | exports._getTextWithExcludedElements = _getTextWithExcludedElements;
|
---|
1277 | exports.handleAutoChangeDetectionStatus = handleAutoChangeDetectionStatus;
|
---|
1278 | exports.manualChangeDetection = manualChangeDetection;
|
---|
1279 | exports.parallel = parallel;
|
---|
1280 | exports.stopHandlingAutoChangeDetectionStatus = stopHandlingAutoChangeDetectionStatus;
|
---|
1281 |
|
---|
1282 | Object.defineProperty(exports, '__esModule', { value: true });
|
---|
1283 |
|
---|
1284 | })));
|
---|
1285 | //# sourceMappingURL=cdk-testing.umd.js.map
|
---|