/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { parallel } from './change-detection'; /** * Base class for component harnesses that all component harness authors should extend. This base * component harness provides the basic ability to locate element and sub-component harness. It * should be inherited when defining user's own harness. */ export class ComponentHarness { constructor(locatorFactory) { this.locatorFactory = locatorFactory; } /** Gets a `Promise` for the `TestElement` representing the host element of the component. */ async host() { return this.locatorFactory.rootElement; } /** * Gets a `LocatorFactory` for the document root element. This factory can be used to create * locators for elements that a component creates outside of its own root element. (e.g. by * appending to document.body). */ documentRootLocatorFactory() { return this.locatorFactory.documentRootLocatorFactory(); } /** * Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance * or element under the host element of this `ComponentHarness`. * @param queries A list of queries specifying which harnesses and elements to search for: * - A `string` searches for elements matching the CSS selector specified by the string. * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the * given class. * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given * predicate. * @return An asynchronous locator function that searches for and returns a `Promise` for the * first element or harness matching the given search criteria. Matches are ordered first by * order in the DOM, and second by order in the queries list. If no matches are found, the * `Promise` rejects. The type that the `Promise` resolves to is a union of all result types for * each query. * * e.g. Given the following DOM: `
`, and assuming * `DivHarness.hostSelector === 'div'`: * - `await ch.locatorFor(DivHarness, 'div')()` gets a `DivHarness` instance for `#d1` * - `await ch.locatorFor('div', DivHarness)()` gets a `TestElement` instance for `#d1` * - `await ch.locatorFor('span')()` throws because the `Promise` rejects. */ locatorFor(...queries) { return this.locatorFactory.locatorFor(...queries); } /** * Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance * or element under the host element of this `ComponentHarness`. * @param queries A list of queries specifying which harnesses and elements to search for: * - A `string` searches for elements matching the CSS selector specified by the string. * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the * given class. * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given * predicate. * @return An asynchronous locator function that searches for and returns a `Promise` for the * first element or harness matching the given search criteria. Matches are ordered first by * order in the DOM, and second by order in the queries list. If no matches are found, the * `Promise` is resolved with `null`. The type that the `Promise` resolves to is a union of all * result types for each query or null. * * e.g. Given the following DOM: `
`, and assuming * `DivHarness.hostSelector === 'div'`: * - `await ch.locatorForOptional(DivHarness, 'div')()` gets a `DivHarness` instance for `#d1` * - `await ch.locatorForOptional('div', DivHarness)()` gets a `TestElement` instance for `#d1` * - `await ch.locatorForOptional('span')()` gets `null`. */ locatorForOptional(...queries) { return this.locatorFactory.locatorForOptional(...queries); } /** * Creates an asynchronous locator function that can be used to find `ComponentHarness` instances * or elements under the host element of this `ComponentHarness`. * @param queries A list of queries specifying which harnesses and elements to search for: * - A `string` searches for elements matching the CSS selector specified by the string. * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the * given class. * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given * predicate. * @return An asynchronous locator function that searches for and returns a `Promise` for all * elements and harnesses matching the given search criteria. Matches are ordered first by * order in the DOM, and second by order in the queries list. If an element matches more than * one `ComponentHarness` class, the locator gets an instance of each for the same element. If * an element matches multiple `string` selectors, only one `TestElement` instance is returned * for that element. The type that the `Promise` resolves to is an array where each element is * the union of all result types for each query. * * e.g. Given the following DOM: `
`, and assuming * `DivHarness.hostSelector === 'div'` and `IdIsD1Harness.hostSelector === '#d1'`: * - `await ch.locatorForAll(DivHarness, 'div')()` gets `[ * DivHarness, // for #d1 * TestElement, // for #d1 * DivHarness, // for #d2 * TestElement // for #d2 * ]` * - `await ch.locatorForAll('div', '#d1')()` gets `[ * TestElement, // for #d1 * TestElement // for #d2 * ]` * - `await ch.locatorForAll(DivHarness, IdIsD1Harness)()` gets `[ * DivHarness, // for #d1 * IdIsD1Harness, // for #d1 * DivHarness // for #d2 * ]` * - `await ch.locatorForAll('span')()` gets `[]`. */ locatorForAll(...queries) { return this.locatorFactory.locatorForAll(...queries); } /** * Flushes change detection and async tasks in the Angular zone. * In most cases it should not be necessary to call this manually. However, there may be some edge * cases where it is needed to fully flush animation events. */ async forceStabilize() { return this.locatorFactory.forceStabilize(); } /** * Waits for all scheduled or running async tasks to complete. This allows harness * authors to wait for async tasks outside of the Angular zone. */ async waitForTasksOutsideAngular() { return this.locatorFactory.waitForTasksOutsideAngular(); } } /** * Base class for component harnesses that authors should extend if they anticipate that consumers * of the harness may want to access other harnesses within the `` of the component. */ export class ContentContainerComponentHarness extends ComponentHarness { async getChildLoader(selector) { return (await this.getRootHarnessLoader()).getChildLoader(selector); } async getAllChildLoaders(selector) { return (await this.getRootHarnessLoader()).getAllChildLoaders(selector); } async getHarness(query) { return (await this.getRootHarnessLoader()).getHarness(query); } async getHarnessOrNull(query) { return (await this.getRootHarnessLoader()).getHarnessOrNull(query); } async getAllHarnesses(query) { return (await this.getRootHarnessLoader()).getAllHarnesses(query); } async hasHarness(query) { return (await this.getRootHarnessLoader()).hasHarness(query); } /** * Gets the root harness loader from which to start * searching for content contained by this harness. */ async getRootHarnessLoader() { return this.locatorFactory.rootHarnessLoader(); } } /** * A class used to associate a ComponentHarness class with predicates functions that can be used to * filter instances of the class. */ export class HarnessPredicate { constructor(harnessType, options) { this.harnessType = harnessType; this._predicates = []; this._descriptions = []; this._addBaseOptions(options); } /** * Checks if the specified nullable string value matches the given pattern. * @param value The nullable string value to check, or a Promise resolving to the * nullable string value. * @param pattern The pattern the value is expected to match. If `pattern` is a string, * `value` is expected to match exactly. If `pattern` is a regex, a partial match is * allowed. If `pattern` is `null`, the value is expected to be `null`. * @return Whether the value matches the pattern. */ static async stringMatches(value, pattern) { value = await value; if (pattern === null) { return value === null; } else if (value === null) { return false; } return typeof pattern === 'string' ? value === pattern : pattern.test(value); } /** * Adds a predicate function to be run against candidate harnesses. * @param description A description of this predicate that may be used in error messages. * @param predicate An async predicate function. * @return this (for method chaining). */ add(description, predicate) { this._descriptions.push(description); this._predicates.push(predicate); return this; } /** * Adds a predicate function that depends on an option value to be run against candidate * harnesses. If the option value is undefined, the predicate will be ignored. * @param name The name of the option (may be used in error messages). * @param option The option value. * @param predicate The predicate function to run if the option value is not undefined. * @return this (for method chaining). */ addOption(name, option, predicate) { if (option !== undefined) { this.add(`${name} = ${_valueAsString(option)}`, item => predicate(item, option)); } return this; } /** * Filters a list of harnesses on this predicate. * @param harnesses The list of harnesses to filter. * @return A list of harnesses that satisfy this predicate. */ async filter(harnesses) { if (harnesses.length === 0) { return []; } const results = await parallel(() => harnesses.map(h => this.evaluate(h))); return harnesses.filter((_, i) => results[i]); } /** * Evaluates whether the given harness satisfies this predicate. * @param harness The harness to check * @return A promise that resolves to true if the harness satisfies this predicate, * and resolves to false otherwise. */ async evaluate(harness) { const results = await parallel(() => this._predicates.map(p => p(harness))); return results.reduce((combined, current) => combined && current, true); } /** Gets a description of this predicate for use in error messages. */ getDescription() { return this._descriptions.join(', '); } /** Gets the selector used to find candidate elements. */ getSelector() { // We don't have to go through the extra trouble if there are no ancestors. if (!this._ancestor) { return (this.harnessType.hostSelector || '').trim(); } const [ancestors, ancestorPlaceholders] = _splitAndEscapeSelector(this._ancestor); const [selectors, selectorPlaceholders] = _splitAndEscapeSelector(this.harnessType.hostSelector || ''); const result = []; // We have to add the ancestor to each part of the host compound selector, otherwise we can get // incorrect results. E.g. `.ancestor .a, .ancestor .b` vs `.ancestor .a, .b`. ancestors.forEach(escapedAncestor => { const ancestor = _restoreSelector(escapedAncestor, ancestorPlaceholders); return selectors.forEach(escapedSelector => result.push(`${ancestor} ${_restoreSelector(escapedSelector, selectorPlaceholders)}`)); }); return result.join(', '); } /** Adds base options common to all harness types. */ _addBaseOptions(options) { this._ancestor = options.ancestor || ''; if (this._ancestor) { this._descriptions.push(`has ancestor matching selector "${this._ancestor}"`); } const selector = options.selector; if (selector !== undefined) { this.add(`host matches selector "${selector}"`, async (item) => { return (await item.host()).matchesSelector(selector); }); } } } /** Represent a value as a string for the purpose of logging. */ function _valueAsString(value) { if (value === undefined) { return 'undefined'; } try { // `JSON.stringify` doesn't handle RegExp properly, so we need a custom replacer. // Use a character that is unlikely to appear in real strings to denote the start and end of // the regex. This allows us to strip out the extra quotes around the value added by // `JSON.stringify`. Also do custom escaping on `"` characters to prevent `JSON.stringify` // from escaping them as if they were part of a string. const stringifiedValue = JSON.stringify(value, (_, v) => v instanceof RegExp ? `◬MAT_RE_ESCAPE◬${v.toString().replace(/"/g, '◬MAT_RE_ESCAPE◬')}◬MAT_RE_ESCAPE◬` : v); // Strip out the extra quotes around regexes and put back the manually escaped `"` characters. return stringifiedValue .replace(/"◬MAT_RE_ESCAPE◬|◬MAT_RE_ESCAPE◬"/g, '') .replace(/◬MAT_RE_ESCAPE◬/g, '"'); } catch { // `JSON.stringify` will throw if the object is cyclical, // in this case the best we can do is report the value as `{...}`. return '{...}'; } } /** * Splits up a compound selector into its parts and escapes any quoted content. The quoted content * has to be escaped, because it can contain commas which will throw throw us off when trying to * split it. * @param selector Selector to be split. * @returns The escaped string where any quoted content is replaced with a placeholder. E.g. * `[foo="bar"]` turns into `[foo=__cdkPlaceholder-0__]`. Use `_restoreSelector` to restore * the placeholders. */ function _splitAndEscapeSelector(selector) { const placeholders = []; // Note that the regex doesn't account for nested quotes so something like `"ab'cd'e"` will be // considered as two blocks. It's a bit of an edge case, but if we find that it's a problem, // we can make it a bit smarter using a loop. Use this for now since it's more readable and // compact. More complete implementation: // https://github.com/angular/angular/blob/bd34bc9e89f18a/packages/compiler/src/shadow_css.ts#L655 const result = selector.replace(/(["'][^["']*["'])/g, (_, keep) => { const replaceBy = `__cdkPlaceholder-${placeholders.length}__`; placeholders.push(keep); return replaceBy; }); return [result.split(',').map(part => part.trim()), placeholders]; } /** Restores a selector whose content was escaped in `_splitAndEscapeSelector`. */ function _restoreSelector(selector, placeholders) { return selector.replace(/__cdkPlaceholder-(\d+)__/g, (_, index) => placeholders[+index]); } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcG9uZW50LWhhcm5lc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8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