1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { __awaiter } from "tslib";
|
---|
9 | import { parallel } from './change-detection';
|
---|
10 | /**
|
---|
11 | * Base class for component harnesses that all component harness authors should extend. This base
|
---|
12 | * component harness provides the basic ability to locate element and sub-component harness. It
|
---|
13 | * should be inherited when defining user's own harness.
|
---|
14 | */
|
---|
15 | export class ComponentHarness {
|
---|
16 | constructor(locatorFactory) {
|
---|
17 | this.locatorFactory = locatorFactory;
|
---|
18 | }
|
---|
19 | /** Gets a `Promise` for the `TestElement` representing the host element of the component. */
|
---|
20 | host() {
|
---|
21 | return __awaiter(this, void 0, void 0, function* () {
|
---|
22 | return this.locatorFactory.rootElement;
|
---|
23 | });
|
---|
24 | }
|
---|
25 | /**
|
---|
26 | * Gets a `LocatorFactory` for the document root element. This factory can be used to create
|
---|
27 | * locators for elements that a component creates outside of its own root element. (e.g. by
|
---|
28 | * appending to document.body).
|
---|
29 | */
|
---|
30 | documentRootLocatorFactory() {
|
---|
31 | return this.locatorFactory.documentRootLocatorFactory();
|
---|
32 | }
|
---|
33 | /**
|
---|
34 | * Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance
|
---|
35 | * or element under the host element of this `ComponentHarness`.
|
---|
36 | * @param queries A list of queries specifying which harnesses and elements to search for:
|
---|
37 | * - A `string` searches for elements matching the CSS selector specified by the string.
|
---|
38 | * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the
|
---|
39 | * given class.
|
---|
40 | * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given
|
---|
41 | * predicate.
|
---|
42 | * @return An asynchronous locator function that searches for and returns a `Promise` for the
|
---|
43 | * first element or harness matching the given search criteria. Matches are ordered first by
|
---|
44 | * order in the DOM, and second by order in the queries list. If no matches are found, the
|
---|
45 | * `Promise` rejects. The type that the `Promise` resolves to is a union of all result types for
|
---|
46 | * each query.
|
---|
47 | *
|
---|
48 | * e.g. Given the following DOM: `<div id="d1" /><div id="d2" />`, and assuming
|
---|
49 | * `DivHarness.hostSelector === 'div'`:
|
---|
50 | * - `await ch.locatorFor(DivHarness, 'div')()` gets a `DivHarness` instance for `#d1`
|
---|
51 | * - `await ch.locatorFor('div', DivHarness)()` gets a `TestElement` instance for `#d1`
|
---|
52 | * - `await ch.locatorFor('span')()` throws because the `Promise` rejects.
|
---|
53 | */
|
---|
54 | locatorFor(...queries) {
|
---|
55 | return this.locatorFactory.locatorFor(...queries);
|
---|
56 | }
|
---|
57 | /**
|
---|
58 | * Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance
|
---|
59 | * or element under the host element of this `ComponentHarness`.
|
---|
60 | * @param queries A list of queries specifying which harnesses and elements to search for:
|
---|
61 | * - A `string` searches for elements matching the CSS selector specified by the string.
|
---|
62 | * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the
|
---|
63 | * given class.
|
---|
64 | * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given
|
---|
65 | * predicate.
|
---|
66 | * @return An asynchronous locator function that searches for and returns a `Promise` for the
|
---|
67 | * first element or harness matching the given search criteria. Matches are ordered first by
|
---|
68 | * order in the DOM, and second by order in the queries list. If no matches are found, the
|
---|
69 | * `Promise` is resolved with `null`. The type that the `Promise` resolves to is a union of all
|
---|
70 | * result types for each query or null.
|
---|
71 | *
|
---|
72 | * e.g. Given the following DOM: `<div id="d1" /><div id="d2" />`, and assuming
|
---|
73 | * `DivHarness.hostSelector === 'div'`:
|
---|
74 | * - `await ch.locatorForOptional(DivHarness, 'div')()` gets a `DivHarness` instance for `#d1`
|
---|
75 | * - `await ch.locatorForOptional('div', DivHarness)()` gets a `TestElement` instance for `#d1`
|
---|
76 | * - `await ch.locatorForOptional('span')()` gets `null`.
|
---|
77 | */
|
---|
78 | locatorForOptional(...queries) {
|
---|
79 | return this.locatorFactory.locatorForOptional(...queries);
|
---|
80 | }
|
---|
81 | /**
|
---|
82 | * Creates an asynchronous locator function that can be used to find `ComponentHarness` instances
|
---|
83 | * or elements under the host element of this `ComponentHarness`.
|
---|
84 | * @param queries A list of queries specifying which harnesses and elements to search for:
|
---|
85 | * - A `string` searches for elements matching the CSS selector specified by the string.
|
---|
86 | * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the
|
---|
87 | * given class.
|
---|
88 | * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given
|
---|
89 | * predicate.
|
---|
90 | * @return An asynchronous locator function that searches for and returns a `Promise` for all
|
---|
91 | * elements and harnesses matching the given search criteria. Matches are ordered first by
|
---|
92 | * order in the DOM, and second by order in the queries list. If an element matches more than
|
---|
93 | * one `ComponentHarness` class, the locator gets an instance of each for the same element. If
|
---|
94 | * an element matches multiple `string` selectors, only one `TestElement` instance is returned
|
---|
95 | * for that element. The type that the `Promise` resolves to is an array where each element is
|
---|
96 | * the union of all result types for each query.
|
---|
97 | *
|
---|
98 | * e.g. Given the following DOM: `<div id="d1" /><div id="d2" />`, and assuming
|
---|
99 | * `DivHarness.hostSelector === 'div'` and `IdIsD1Harness.hostSelector === '#d1'`:
|
---|
100 | * - `await ch.locatorForAll(DivHarness, 'div')()` gets `[
|
---|
101 | * DivHarness, // for #d1
|
---|
102 | * TestElement, // for #d1
|
---|
103 | * DivHarness, // for #d2
|
---|
104 | * TestElement // for #d2
|
---|
105 | * ]`
|
---|
106 | * - `await ch.locatorForAll('div', '#d1')()` gets `[
|
---|
107 | * TestElement, // for #d1
|
---|
108 | * TestElement // for #d2
|
---|
109 | * ]`
|
---|
110 | * - `await ch.locatorForAll(DivHarness, IdIsD1Harness)()` gets `[
|
---|
111 | * DivHarness, // for #d1
|
---|
112 | * IdIsD1Harness, // for #d1
|
---|
113 | * DivHarness // for #d2
|
---|
114 | * ]`
|
---|
115 | * - `await ch.locatorForAll('span')()` gets `[]`.
|
---|
116 | */
|
---|
117 | locatorForAll(...queries) {
|
---|
118 | return this.locatorFactory.locatorForAll(...queries);
|
---|
119 | }
|
---|
120 | /**
|
---|
121 | * Flushes change detection and async tasks in the Angular zone.
|
---|
122 | * In most cases it should not be necessary to call this manually. However, there may be some edge
|
---|
123 | * cases where it is needed to fully flush animation events.
|
---|
124 | */
|
---|
125 | forceStabilize() {
|
---|
126 | return __awaiter(this, void 0, void 0, function* () {
|
---|
127 | return this.locatorFactory.forceStabilize();
|
---|
128 | });
|
---|
129 | }
|
---|
130 | /**
|
---|
131 | * Waits for all scheduled or running async tasks to complete. This allows harness
|
---|
132 | * authors to wait for async tasks outside of the Angular zone.
|
---|
133 | */
|
---|
134 | waitForTasksOutsideAngular() {
|
---|
135 | return __awaiter(this, void 0, void 0, function* () {
|
---|
136 | return this.locatorFactory.waitForTasksOutsideAngular();
|
---|
137 | });
|
---|
138 | }
|
---|
139 | }
|
---|
140 | /**
|
---|
141 | * Base class for component harnesses that authors should extend if they anticipate that consumers
|
---|
142 | * of the harness may want to access other harnesses within the `<ng-content>` of the component.
|
---|
143 | */
|
---|
144 | export class ContentContainerComponentHarness extends ComponentHarness {
|
---|
145 | getChildLoader(selector) {
|
---|
146 | return __awaiter(this, void 0, void 0, function* () {
|
---|
147 | return (yield this.getRootHarnessLoader()).getChildLoader(selector);
|
---|
148 | });
|
---|
149 | }
|
---|
150 | getAllChildLoaders(selector) {
|
---|
151 | return __awaiter(this, void 0, void 0, function* () {
|
---|
152 | return (yield this.getRootHarnessLoader()).getAllChildLoaders(selector);
|
---|
153 | });
|
---|
154 | }
|
---|
155 | getHarness(query) {
|
---|
156 | return __awaiter(this, void 0, void 0, function* () {
|
---|
157 | return (yield this.getRootHarnessLoader()).getHarness(query);
|
---|
158 | });
|
---|
159 | }
|
---|
160 | getAllHarnesses(query) {
|
---|
161 | return __awaiter(this, void 0, void 0, function* () {
|
---|
162 | return (yield this.getRootHarnessLoader()).getAllHarnesses(query);
|
---|
163 | });
|
---|
164 | }
|
---|
165 | /**
|
---|
166 | * Gets the root harness loader from which to start
|
---|
167 | * searching for content contained by this harness.
|
---|
168 | */
|
---|
169 | getRootHarnessLoader() {
|
---|
170 | return __awaiter(this, void 0, void 0, function* () {
|
---|
171 | return this.locatorFactory.rootHarnessLoader();
|
---|
172 | });
|
---|
173 | }
|
---|
174 | }
|
---|
175 | /**
|
---|
176 | * A class used to associate a ComponentHarness class with predicates functions that can be used to
|
---|
177 | * filter instances of the class.
|
---|
178 | */
|
---|
179 | export class HarnessPredicate {
|
---|
180 | constructor(harnessType, options) {
|
---|
181 | this.harnessType = harnessType;
|
---|
182 | this._predicates = [];
|
---|
183 | this._descriptions = [];
|
---|
184 | this._addBaseOptions(options);
|
---|
185 | }
|
---|
186 | /**
|
---|
187 | * Checks if the specified nullable string value matches the given pattern.
|
---|
188 | * @param value The nullable string value to check, or a Promise resolving to the
|
---|
189 | * nullable string value.
|
---|
190 | * @param pattern The pattern the value is expected to match. If `pattern` is a string,
|
---|
191 | * `value` is expected to match exactly. If `pattern` is a regex, a partial match is
|
---|
192 | * allowed. If `pattern` is `null`, the value is expected to be `null`.
|
---|
193 | * @return Whether the value matches the pattern.
|
---|
194 | */
|
---|
195 | static stringMatches(value, pattern) {
|
---|
196 | return __awaiter(this, void 0, void 0, function* () {
|
---|
197 | value = yield value;
|
---|
198 | if (pattern === null) {
|
---|
199 | return value === null;
|
---|
200 | }
|
---|
201 | else if (value === null) {
|
---|
202 | return false;
|
---|
203 | }
|
---|
204 | return typeof pattern === 'string' ? value === pattern : pattern.test(value);
|
---|
205 | });
|
---|
206 | }
|
---|
207 | /**
|
---|
208 | * Adds a predicate function to be run against candidate harnesses.
|
---|
209 | * @param description A description of this predicate that may be used in error messages.
|
---|
210 | * @param predicate An async predicate function.
|
---|
211 | * @return this (for method chaining).
|
---|
212 | */
|
---|
213 | add(description, predicate) {
|
---|
214 | this._descriptions.push(description);
|
---|
215 | this._predicates.push(predicate);
|
---|
216 | return this;
|
---|
217 | }
|
---|
218 | /**
|
---|
219 | * Adds a predicate function that depends on an option value to be run against candidate
|
---|
220 | * harnesses. If the option value is undefined, the predicate will be ignored.
|
---|
221 | * @param name The name of the option (may be used in error messages).
|
---|
222 | * @param option The option value.
|
---|
223 | * @param predicate The predicate function to run if the option value is not undefined.
|
---|
224 | * @return this (for method chaining).
|
---|
225 | */
|
---|
226 | addOption(name, option, predicate) {
|
---|
227 | if (option !== undefined) {
|
---|
228 | this.add(`${name} = ${_valueAsString(option)}`, item => predicate(item, option));
|
---|
229 | }
|
---|
230 | return this;
|
---|
231 | }
|
---|
232 | /**
|
---|
233 | * Filters a list of harnesses on this predicate.
|
---|
234 | * @param harnesses The list of harnesses to filter.
|
---|
235 | * @return A list of harnesses that satisfy this predicate.
|
---|
236 | */
|
---|
237 | filter(harnesses) {
|
---|
238 | return __awaiter(this, void 0, void 0, function* () {
|
---|
239 | if (harnesses.length === 0) {
|
---|
240 | return [];
|
---|
241 | }
|
---|
242 | const results = yield parallel(() => harnesses.map(h => this.evaluate(h)));
|
---|
243 | return harnesses.filter((_, i) => results[i]);
|
---|
244 | });
|
---|
245 | }
|
---|
246 | /**
|
---|
247 | * Evaluates whether the given harness satisfies this predicate.
|
---|
248 | * @param harness The harness to check
|
---|
249 | * @return A promise that resolves to true if the harness satisfies this predicate,
|
---|
250 | * and resolves to false otherwise.
|
---|
251 | */
|
---|
252 | evaluate(harness) {
|
---|
253 | return __awaiter(this, void 0, void 0, function* () {
|
---|
254 | const results = yield parallel(() => this._predicates.map(p => p(harness)));
|
---|
255 | return results.reduce((combined, current) => combined && current, true);
|
---|
256 | });
|
---|
257 | }
|
---|
258 | /** Gets a description of this predicate for use in error messages. */
|
---|
259 | getDescription() {
|
---|
260 | return this._descriptions.join(', ');
|
---|
261 | }
|
---|
262 | /** Gets the selector used to find candidate elements. */
|
---|
263 | getSelector() {
|
---|
264 | // We don't have to go through the extra trouble if there are no ancestors.
|
---|
265 | if (!this._ancestor) {
|
---|
266 | return (this.harnessType.hostSelector || '').trim();
|
---|
267 | }
|
---|
268 | const [ancestors, ancestorPlaceholders] = _splitAndEscapeSelector(this._ancestor);
|
---|
269 | const [selectors, selectorPlaceholders] = _splitAndEscapeSelector(this.harnessType.hostSelector || '');
|
---|
270 | const result = [];
|
---|
271 | // We have to add the ancestor to each part of the host compound selector, otherwise we can get
|
---|
272 | // incorrect results. E.g. `.ancestor .a, .ancestor .b` vs `.ancestor .a, .b`.
|
---|
273 | ancestors.forEach(escapedAncestor => {
|
---|
274 | const ancestor = _restoreSelector(escapedAncestor, ancestorPlaceholders);
|
---|
275 | return selectors.forEach(escapedSelector => result.push(`${ancestor} ${_restoreSelector(escapedSelector, selectorPlaceholders)}`));
|
---|
276 | });
|
---|
277 | return result.join(', ');
|
---|
278 | }
|
---|
279 | /** Adds base options common to all harness types. */
|
---|
280 | _addBaseOptions(options) {
|
---|
281 | this._ancestor = options.ancestor || '';
|
---|
282 | if (this._ancestor) {
|
---|
283 | this._descriptions.push(`has ancestor matching selector "${this._ancestor}"`);
|
---|
284 | }
|
---|
285 | const selector = options.selector;
|
---|
286 | if (selector !== undefined) {
|
---|
287 | this.add(`host matches selector "${selector}"`, (item) => __awaiter(this, void 0, void 0, function* () {
|
---|
288 | return (yield item.host()).matchesSelector(selector);
|
---|
289 | }));
|
---|
290 | }
|
---|
291 | }
|
---|
292 | }
|
---|
293 | /** Represent a value as a string for the purpose of logging. */
|
---|
294 | function _valueAsString(value) {
|
---|
295 | if (value === undefined) {
|
---|
296 | return 'undefined';
|
---|
297 | }
|
---|
298 | try {
|
---|
299 | // `JSON.stringify` doesn't handle RegExp properly, so we need a custom replacer.
|
---|
300 | // Use a character that is unlikely to appear in real strings to denote the start and end of
|
---|
301 | // the regex. This allows us to strip out the extra quotes around the value added by
|
---|
302 | // `JSON.stringify`. Also do custom escaping on `"` characters to prevent `JSON.stringify`
|
---|
303 | // from escaping them as if they were part of a string.
|
---|
304 | const stringifiedValue = JSON.stringify(value, (_, v) => v instanceof RegExp ?
|
---|
305 | `◬MAT_RE_ESCAPE◬${v.toString().replace(/"/g, '◬MAT_RE_ESCAPE◬')}◬MAT_RE_ESCAPE◬` : v);
|
---|
306 | // Strip out the extra quotes around regexes and put back the manually escaped `"` characters.
|
---|
307 | return stringifiedValue
|
---|
308 | .replace(/"◬MAT_RE_ESCAPE◬|◬MAT_RE_ESCAPE◬"/g, '')
|
---|
309 | .replace(/◬MAT_RE_ESCAPE◬/g, '"');
|
---|
310 | }
|
---|
311 | catch (_a) {
|
---|
312 | // `JSON.stringify` will throw if the object is cyclical,
|
---|
313 | // in this case the best we can do is report the value as `{...}`.
|
---|
314 | return '{...}';
|
---|
315 | }
|
---|
316 | }
|
---|
317 | /**
|
---|
318 | * Splits up a compound selector into its parts and escapes any quoted content. The quoted content
|
---|
319 | * has to be escaped, because it can contain commas which will throw throw us off when trying to
|
---|
320 | * split it.
|
---|
321 | * @param selector Selector to be split.
|
---|
322 | * @returns The escaped string where any quoted content is replaced with a placeholder. E.g.
|
---|
323 | * `[foo="bar"]` turns into `[foo=__cdkPlaceholder-0__]`. Use `_restoreSelector` to restore
|
---|
324 | * the placeholders.
|
---|
325 | */
|
---|
326 | function _splitAndEscapeSelector(selector) {
|
---|
327 | const placeholders = [];
|
---|
328 | // Note that the regex doesn't account for nested quotes so something like `"ab'cd'e"` will be
|
---|
329 | // considered as two blocks. It's a bit of an edge case, but if we find that it's a problem,
|
---|
330 | // we can make it a bit smarter using a loop. Use this for now since it's more readable and
|
---|
331 | // compact. More complete implementation:
|
---|
332 | // https://github.com/angular/angular/blob/bd34bc9e89f18a/packages/compiler/src/shadow_css.ts#L655
|
---|
333 | const result = selector.replace(/(["'][^["']*["'])/g, (_, keep) => {
|
---|
334 | const replaceBy = `__cdkPlaceholder-${placeholders.length}__`;
|
---|
335 | placeholders.push(keep);
|
---|
336 | return replaceBy;
|
---|
337 | });
|
---|
338 | return [result.split(',').map(part => part.trim()), placeholders];
|
---|
339 | }
|
---|
340 | /** Restores a selector whose content was escaped in `_splitAndEscapeSelector`. */
|
---|
341 | function _restoreSelector(selector, placeholders) {
|
---|
342 | return selector.replace(/__cdkPlaceholder-(\d+)__/g, (_, index) => placeholders[+index]);
|
---|
343 | }
|
---|
344 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcG9uZW50LWhhcm5lc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvY2RrL3Rlc3RpbmcvY29tcG9uZW50LWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOztBQUVILE9BQU8sRUFBQyxRQUFRLEVBQUMsTUFBTSxvQkFBb0IsQ0FBQztBQTZPNUM7Ozs7R0FJRztBQUNILE1BQU0sT0FBZ0IsZ0JBQWdCO0lBQ3BDLFlBQStCLGNBQThCO1FBQTlCLG1CQUFjLEdBQWQsY0FBYyxDQUFnQjtJQUFHLENBQUM7SUFFakUsNkZBQTZGO0lBQ3ZGLElBQUk7O1lBQ1IsT0FBTyxJQUFJLENBQUMsY0FBYyxDQUFDLFdBQVcsQ0FBQztRQUN6QyxDQUFDO0tBQUE7SUFFRDs7OztPQUlHO0lBQ08sMEJBQTBCO1FBQ2xDLE9BQU8sSUFBSSxDQUFDLGNBQWMsQ0FBQywwQkFBMEIsRUFBRSxDQUFDO0lBQzFELENBQUM7SUFFRDs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7T0FvQkc7SUFDTyxVQUFVLENBQTJDLEdBQUcsT0FBVTtRQUUxRSxPQUFPLElBQUksQ0FBQyxjQUFjLENBQUMsVUFBVSxDQUFDLEdBQUcsT0FBTyxDQUFDLENBQUM7SUFDcEQsQ0FBQztJQUVEOzs7Ozs7Ozs7Ozs7Ozs7Ozs7OztPQW9CRztJQUNPLGtCQUFrQixDQUEyQyxHQUFHLE9BQVU7UUFFbEYsT0FBTyxJQUFJLENBQUMsY0FBYyxDQUFDLGtCQ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