UNPKG

@angular/cdk

Version:

Angular Material Component Development Kit

909 lines 389 kB
{ "repo": "angular/components", "moduleLabel": "@angular/cdk/testing", "moduleName": "@angular/cdk/testing", "normalizedModuleName": "angular_cdk_testing", "entries": [ { "name": "getNoKeysSpecifiedError", "signatures": [ { "name": "getNoKeysSpecifiedError", "entryType": "function", "description": "Returns an error which reports that no keys have been specified.", "generics": [], "isNewType": false, "jsdocTags": [ { "name": "docs-private", "comment": "" } ], "params": [], "rawComment": "/**\n * Returns an error which reports that no keys have been specified.\n * @docs-private\n */", "returnType": "Error" } ], "implementation": { "params": [], "isNewType": false, "returnType": "Error", "generics": [], "name": "getNoKeysSpecifiedError", "description": "Returns an error which reports that no keys have been specified.", "entryType": "function", "jsdocTags": [ { "name": "docs-private", "comment": "" } ], "rawComment": "/**\n * Returns an error which reports that no keys have been specified.\n * @docs-private\n */" }, "entryType": "function", "description": "Returns an error which reports that no keys have been specified.", "jsdocTags": [ { "name": "docs-private", "comment": "" } ], "rawComment": "/**\n * Returns an error which reports that no keys have been specified.\n * @docs-private\n */", "source": { "filePath": "/src/cdk/testing/test-element-errors.ts", "startLine": 13, "endLine": 15 } }, { "name": "ElementDimensions", "isAbstract": false, "entryType": "interface", "members": [ { "name": "top", "type": "number", "memberType": "property", "memberTags": [], "description": "The distance from the top of the viewport in pixels", "jsdocTags": [] }, { "name": "left", "type": "number", "memberType": "property", "memberTags": [], "description": "The distance from the left of the viewport in pixels", "jsdocTags": [] }, { "name": "width", "type": "number", "memberType": "property", "memberTags": [], "description": "The width of the element in pixels", "jsdocTags": [] }, { "name": "height", "type": "number", "memberType": "property", "memberTags": [], "description": "The height of the element in pixels", "jsdocTags": [] } ], "generics": [], "description": "Dimensions for element size and its position relative to the viewport.", "jsdocTags": [], "rawComment": "/**\n * Dimensions for element size and its position relative to the viewport.\n */", "implements": [], "source": { "filePath": "/src/cdk/testing/element-dimensions.ts", "startLine": 12, "endLine": 21 } }, { "name": "AutoChangeDetectionStatus", "isAbstract": false, "entryType": "interface", "members": [ { "name": "isDisabled", "type": "boolean", "memberType": "property", "memberTags": [], "description": "Whether auto change detection is disabled.", "jsdocTags": [] }, { "name": "onDetectChangesNow", "type": "(() => void) | undefined", "memberType": "property", "memberTags": [ "optional" ], "description": "An optional callback, if present it indicates that change detection should be run immediately,\nwhile handling the status change. The callback should then be called as soon as change\ndetection is done.", "jsdocTags": [] } ], "generics": [], "description": "The status of the test harness auto change detection. If not diabled test harnesses will\nautomatically trigger change detection after every action (such as a click) and before every read\n(such as getting the text of an element).", "jsdocTags": [], "rawComment": "/**\n * The status of the test harness auto change detection. If not diabled test harnesses will\n * automatically trigger change detection after every action (such as a click) and before every read\n * (such as getting the text of an element).\n */", "implements": [], "source": { "filePath": "src/cdk/testing/change-detection.ts", "startLine": 16, "endLine": 25 } }, { "name": "ModifierKeys", "isAbstract": false, "entryType": "interface", "members": [ { "name": "control", "type": "boolean | undefined", "memberType": "property", "memberTags": [ "optional" ], "description": "", "jsdocTags": [] }, { "name": "alt", "type": "boolean | undefined", "memberType": "property", "memberTags": [ "optional" ], "description": "", "jsdocTags": [] }, { "name": "shift", "type": "boolean | undefined", "memberType": "property", "memberTags": [ "optional" ], "description": "", "jsdocTags": [] }, { "name": "meta", "type": "boolean | undefined", "memberType": "property", "memberTags": [ "optional" ], "description": "", "jsdocTags": [] } ], "generics": [], "description": "Modifier keys that may be held while typing.", "jsdocTags": [], "rawComment": "/** Modifier keys that may be held while typing. */", "implements": [], "source": { "filePath": "/src/cdk/testing/test-element.ts", "startLine": 12, "endLine": 17 } }, { "name": "AsyncFactoryFn", "type": "() => Promise<T>", "entryType": "type_alias", "generics": [ { "name": "T" } ], "rawComment": "/**\n * An async function that returns a promise when called.\n * @deprecated This was just an alias for `() => Promise<T>`. Use that instead.\n * @breaking-change 21.0.0 Remove this alias.\n * @docs-private\n */", "description": "An async function that returns a promise when called.", "jsdocTags": [ { "name": "deprecated", "comment": "This was just an alias for `() => Promise<T>`. Use that instead." }, { "name": "breaking-change", "comment": "21.0.0 Remove this alias." }, { "name": "docs-private", "comment": "" } ], "source": { "filePath": "src/cdk/testing/component-harness.ts", "startLine": 18, "endLine": 18 } }, { "name": "EventData", "type": "| string\n | number\n | boolean\n | Function\n | undefined\n | null\n | EventData[]\n | {[key: string]: EventData}", "entryType": "type_alias", "generics": [], "rawComment": "/** Data that can be attached to a custom event dispatched from a `TestElement`. */", "description": "Data that can be attached to a custom event dispatched from a `TestElement`.", "jsdocTags": [], "source": { "filePath": "/src/cdk/testing/test-element.ts", "startLine": 20, "endLine": 28 } }, { "name": "AsyncPredicate", "type": "(item: T) => Promise<boolean>", "entryType": "type_alias", "generics": [ { "name": "T" } ], "rawComment": "/** An async function that takes an item and returns a boolean promise */", "description": "An async function that takes an item and returns a boolean promise", "jsdocTags": [], "source": { "filePath": "src/cdk/testing/component-harness.ts", "startLine": 21, "endLine": 21 } }, { "name": "TestKey", "entryType": "enum", "members": [ { "name": "BACKSPACE", "type": "TestKey.BACKSPACE", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "TAB", "type": "TestKey.TAB", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "ENTER", "type": "TestKey.ENTER", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "SHIFT", "type": "TestKey.SHIFT", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "CONTROL", "type": "TestKey.CONTROL", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "ALT", "type": "TestKey.ALT", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "ESCAPE", "type": "TestKey.ESCAPE", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "PAGE_UP", "type": "TestKey.PAGE_UP", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "PAGE_DOWN", "type": "TestKey.PAGE_DOWN", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "END", "type": "TestKey.END", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "HOME", "type": "TestKey.HOME", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "LEFT_ARROW", "type": "TestKey.LEFT_ARROW", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "UP_ARROW", "type": "TestKey.UP_ARROW", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "RIGHT_ARROW", "type": "TestKey.RIGHT_ARROW", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "DOWN_ARROW", "type": "TestKey.DOWN_ARROW", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "INSERT", "type": "TestKey.INSERT", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "DELETE", "type": "TestKey.DELETE", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "F1", "type": "TestKey.F1", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "F2", "type": "TestKey.F2", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "F3", "type": "TestKey.F3", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "F4", "type": "TestKey.F4", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "F5", "type": "TestKey.F5", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "F6", "type": "TestKey.F6", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "F7", "type": "TestKey.F7", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "F8", "type": "TestKey.F8", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "F9", "type": "TestKey.F9", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "F10", "type": "TestKey.F10", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "F11", "type": "TestKey.F11", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "F12", "type": "TestKey.F12", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "META", "type": "TestKey.META", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] }, { "name": "COMMA", "type": "TestKey.COMMA", "value": "", "memberType": "enum_item", "jsdocTags": [], "description": "", "memberTags": [] } ], "rawComment": "/** An enum of non-text keys that can be used with the `sendKeys` method. */", "description": "An enum of non-text keys that can be used with the `sendKeys` method.", "jsdocTags": [], "source": { "filePath": "/src/cdk/testing/test-element.ts", "startLine": 37, "endLine": 69 } }, { "name": "AsyncOptionPredicate", "type": "(item: T, option: O) => Promise<boolean>", "entryType": "type_alias", "generics": [ { "name": "T" }, { "name": "O" } ], "rawComment": "/** An async function that takes an item and an option value and returns a boolean promise. */", "description": "An async function that takes an item and an option value and returns a boolean promise.", "jsdocTags": [], "source": { "filePath": "src/cdk/testing/component-harness.ts", "startLine": 24, "endLine": 24 } }, { "name": "HarnessQuery", "type": "| ComponentHarnessConstructor<T>\n | HarnessPredicate<T>", "entryType": "type_alias", "generics": [ { "name": "T", "constraint": "ComponentHarness" } ], "rawComment": "/**\n * A query for a `ComponentHarness`, which is expressed as either a `ComponentHarnessConstructor` or\n * a `HarnessPredicate`.\n */", "description": "A query for a `ComponentHarness`, which is expressed as either a `ComponentHarnessConstructor` or\na `HarnessPredicate`.", "jsdocTags": [], "source": { "filePath": "src/cdk/testing/component-harness.ts", "startLine": 30, "endLine": 32 } }, { "name": "LocatorFnResult", "type": "{\n [I in keyof T]: T[I] extends new (...args: any[]) => infer C // Map `ComponentHarnessConstructor<C>` to `C`.\n ? C\n : // Map `HarnessPredicate<C>` to `C`.\n T[I] extends {harnessType: new (...args: any[]) => infer C}\n ? C\n : // Map `string` to `TestElement`.\n T[I] extends string\n ? TestElement\n : // Map everything else to `never` (should not happen due to the type constraint on `T`).\n never;\n}[number]", "entryType": "type_alias", "generics": [ { "name": "T", "constraint": "(HarnessQuery<any> | string)[]" } ], "rawComment": "/**\n * The result type obtained when searching using a particular list of queries. This type depends on\n * the particular items being queried.\n * - If one of the queries is for a `ComponentHarnessConstructor<C1>`, it means that the result\n * might be a harness of type `C1`\n * - If one of the queries is for a `HarnessPredicate<C2>`, it means that the result might be a\n * harness of type `C2`\n * - If one of the queries is for a `string`, it means that the result might be a `TestElement`.\n *\n * Since we don't know for sure which query will match, the result type if the union of the types\n * for all possible results.\n *\n * @usageNotes\n * ### Example\n *\n * The type:\n * ```ts\n * LocatorFnResult<[\n * ComponentHarnessConstructor<MyHarness>,\n * HarnessPredicate<MyOtherHarness>,\n * string\n * ]>\n * ```\n *\n * is equivalent to:\n *\n * ```ts\n * MyHarness | MyOtherHarness | TestElement\n * ```\n */", "description": "The result type obtained when searching using a particular list of queries. This type depends on\nthe particular items being queried.\n- If one of the queries is for a `ComponentHarnessConstructor<C1>`, it means that the result\n might be a harness of type `C1`\n- If one of the queries is for a `HarnessPredicate<C2>`, it means that the result might be a\n harness of type `C2`\n- If one of the queries is for a `string`, it means that the result might be a `TestElement`.\n\nSince we don't know for sure which query will match, the result type if the union of the types\nfor all possible results.", "jsdocTags": [ { "name": "usageNotes", "comment": "### Example\n\nThe type:\n```ts\nLocatorFnResult<[\n ComponentHarnessConstructor<MyHarness>,\n HarnessPredicate<MyOtherHarness>,\n string\n]>\n```\n\nis equivalent to:\n\n```ts\nMyHarness | MyOtherHarness | TestElement\n```" } ], "source": { "filePath": "src/cdk/testing/component-harness.ts", "startLine": 64, "endLine": 75 } }, { "name": "HarnessEnvironment", "isAbstract": true, "entryType": "undecorated_class", "members": [ { "name": "constructor", "signatures": [], "implementation": { "params": [ { "name": "rawRootElement", "description": "The native root element of this `HarnessEnvironment`.", "type": "E", "isOptional": false, "isRestParam": false } ], "isNewType": false, "returnType": "HarnessEnvironment<E>", "generics": [], "name": "constructor", "description": "", "entryType": "function", "jsdocTags": [], "rawComment": "" }, "entryType": "function", "description": "", "jsdocTags": [], "rawComment": "", "memberType": "method", "memberTags": [ "protected" ] }, { "name": "rootElement", "type": "TestElement", "memberType": "getter", "memberTags": [], "description": "The root element of this `HarnessEnvironment` as a `TestElement`.", "jsdocTags": [] }, { "name": "rootElement", "type": "TestElement", "memberType": "setter", "memberTags": [], "description": "", "jsdocTags": [] }, { "name": "documentRootLocatorFactory", "signatures": [ { "name": "documentRootLocatorFactory", "entryType": "function", "description": "Gets a locator factory rooted at the document root.", "generics": [], "isNewType": false, "jsdocTags": [], "params": [], "rawComment": "/** Gets a locator factory rooted at the document root. */", "returnType": "LocatorFactory" } ], "implementation": { "params": [], "isNewType": false, "returnType": "LocatorFactory", "generics": [], "name": "documentRootLocatorFactory", "description": "Gets a locator factory rooted at the document root.", "entryType": "function", "jsdocTags": [], "rawComment": "/** Gets a locator factory rooted at the document root. */" }, "entryType": "function", "description": "Gets a locator factory rooted at the document root.", "jsdocTags": [], "rawComment": "/** Gets a locator factory rooted at the document root. */", "memberType": "method", "memberTags": [] }, { "name": "locatorFor", "signatures": [ { "name": "locatorFor", "entryType": "function", "description": "Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance\nor element under the root element of this `HarnessEnvironment`.\n\nFor example, given the following DOM and assuming `DivHarness.hostSelector` is `'div'`\n\n```html\n<div id=\"d1\"></div><div id=\"d2\"></div>\n```\n\nthen we expect:\n\n```ts\nawait lf.locatorFor(DivHarness, 'div')() // Gets a `DivHarness` instance for #d1\nawait lf.locatorFor('div', DivHarness)() // Gets a `TestElement` instance for #d1\nawait lf.locatorFor('span')() // Throws because the `Promise` rejects\n```", "generics": [ { "name": "T", "constraint": "(HarnessQuery<any> | string)[]" } ], "isNewType": false, "jsdocTags": [ { "name": "param", "comment": "A list of queries specifying which harnesses and elements to search for:\n- A `string` searches for elements matching the CSS selector specified by the string.\n- A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\ngiven class.\n- A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\npredicate." }, { "name": "return", "comment": "An asynchronous locator function that searches for and returns a `Promise` for the\nfirst element or harness matching the given search criteria. Matches are ordered first by\norder in the DOM, and second by order in the queries list. If no matches are found, the\n`Promise` rejects. The type that the `Promise` resolves to is a union of all result types for\neach query." } ], "params": [ { "name": "queries", "description": "A list of queries specifying which harnesses and elements to search for:\n- A `string` searches for elements matching the CSS selector specified by the string.\n- A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\ngiven class.\n- A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\npredicate.", "type": "T", "isOptional": false, "isRestParam": true } ], "rawComment": "/**\n * Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance\n * or element under the root element of this `HarnessEnvironment`.\n *\n * For example, given the following DOM and assuming `DivHarness.hostSelector` is `'div'`\n *\n * ```html\n * <div id=\"d1\"></div><div id=\"d2\"></div>\n * ```\n *\n * then we expect:\n *\n * ```ts\n * await lf.locatorFor(DivHarness, 'div')() // Gets a `DivHarness` instance for #d1\n * await lf.locatorFor('div', DivHarness)() // Gets a `TestElement` instance for #d1\n * await lf.locatorFor('span')() // Throws because the `Promise` rejects\n * ```\n *\n * @param queries A list of queries specifying which harnesses and elements to search for:\n * - A `string` searches for elements matching the CSS selector specified by the string.\n * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\n * given class.\n * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\n * predicate.\n * @return An asynchronous locator function that searches for and returns a `Promise` for the\n * first element or harness matching the given search criteria. Matches are ordered first by\n * order in the DOM, and second by order in the queries list. If no matches are found, the\n * `Promise` rejects. The type that the `Promise` resolves to is a union of all result types for\n * each query.\n */", "returnType": "() => Promise<LocatorFnResult<T>>" } ], "implementation": { "params": [ { "name": "queries", "description": "A list of queries specifying which harnesses and elements to search for:\n- A `string` searches for elements matching the CSS selector specified by the string.\n- A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\ngiven class.\n- A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\npredicate.", "type": "T", "isOptional": false, "isRestParam": true } ], "isNewType": false, "returnType": "() => Promise<LocatorFnResult<T>>", "generics": [ { "name": "T", "constraint": "(HarnessQuery<any> | string)[]" } ], "name": "locatorFor", "description": "Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance\nor element under the root element of this `HarnessEnvironment`.\n\nFor example, given the following DOM and assuming `DivHarness.hostSelector` is `'div'`\n\n```html\n<div id=\"d1\"></div><div id=\"d2\"></div>\n```\n\nthen we expect:\n\n```ts\nawait lf.locatorFor(DivHarness, 'div')() // Gets a `DivHarness` instance for #d1\nawait lf.locatorFor('div', DivHarness)() // Gets a `TestElement` instance for #d1\nawait lf.locatorFor('span')() // Throws because the `Promise` rejects\n```", "entryType": "function", "jsdocTags": [ { "name": "param", "comment": "A list of queries specifying which harnesses and elements to search for:\n- A `string` searches for elements matching the CSS selector specified by the string.\n- A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\ngiven class.\n- A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\npredicate." }, { "name": "return", "comment": "An asynchronous locator function that searches for and returns a `Promise` for the\nfirst element or harness matching the given search criteria. Matches are ordered first by\norder in the DOM, and second by order in the queries list. If no matches are found, the\n`Promise` rejects. The type that the `Promise` resolves to is a union of all result types for\neach query." } ], "rawComment": "/**\n * Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance\n * or element under the root element of this `HarnessEnvironment`.\n *\n * For example, given the following DOM and assuming `DivHarness.hostSelector` is `'div'`\n *\n * ```html\n * <div id=\"d1\"></div><div id=\"d2\"></div>\n * ```\n *\n * then we expect:\n *\n * ```ts\n * await lf.locatorFor(DivHarness, 'div')() // Gets a `DivHarness` instance for #d1\n * await lf.locatorFor('div', DivHarness)() // Gets a `TestElement` instance for #d1\n * await lf.locatorFor('span')() // Throws because the `Promise` rejects\n * ```\n *\n * @param queries A list of queries specifying which harnesses and elements to search for:\n * - A `string` searches for elements matching the CSS selector specified by the string.\n * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\n * given class.\n * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\n * predicate.\n * @return An asynchronous locator function that searches for and returns a `Promise` for the\n * first element or harness matching the given search criteria. Matches are ordered first by\n * order in the DOM, and second by order in the queries list. If no matches are found, the\n * `Promise` rejects. The type that the `Promise` resolves to is a union of all result types for\n * each query.\n */" }, "entryType": "function", "description": "Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance\nor element under the root element of this `HarnessEnvironment`.\n\nFor example, given the following DOM and assuming `DivHarness.hostSelector` is `'div'`\n\n```html\n<div id=\"d1\"></div><div id=\"d2\"></div>\n```\n\nthen we expect:\n\n```ts\nawait lf.locatorFor(DivHarness, 'div')() // Gets a `DivHarness` instance for #d1\nawait lf.locatorFor('div', DivHarness)() // Gets a `TestElement` instance for #d1\nawait lf.locatorFor('span')() // Throws because the `Promise` rejects\n```", "jsdocTags": [ { "name": "param", "comment": "A list of queries specifying which harnesses and elements to search for:\n- A `string` searches for elements matching the CSS selector specified by the string.\n- A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\ngiven class.\n- A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\npredicate." }, { "name": "return", "comment": "An asynchronous locator function that searches for and returns a `Promise` for the\nfirst element or harness matching the given search criteria. Matches are ordered first by\norder in the DOM, and second by order in the queries list. If no matches are found, the\n`Promise` rejects. The type that the `Promise` resolves to is a union of all result types for\neach query." } ], "rawComment": "/**\n * Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance\n * or element under the root element of this `HarnessEnvironment`.\n *\n * For example, given the following DOM and assuming `DivHarness.hostSelector` is `'div'`\n *\n * ```html\n * <div id=\"d1\"></div><div id=\"d2\"></div>\n * ```\n *\n * then we expect:\n *\n * ```ts\n * await lf.locatorFor(DivHarness, 'div')() // Gets a `DivHarness` instance for #d1\n * await lf.locatorFor('div', DivHarness)() // Gets a `TestElement` instance for #d1\n * await lf.locatorFor('span')() // Throws because the `Promise` rejects\n * ```\n *\n * @param queries A list of queries specifying which harnesses and elements to search for:\n * - A `string` searches for elements matching the CSS selector specified by the string.\n * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\n * given class.\n * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\n * predicate.\n * @return An asynchronous locator function that searches for and returns a `Promise` for the\n * first element or harness matching the given search criteria. Matches are ordered first by\n * order in the DOM, and second by order in the queries list. If no matches are found, the\n * `Promise` rejects. The type that the `Promise` resolves to is a union of all result types for\n * each query.\n */", "memberType": "method", "memberTags": [] }, { "name": "locatorForOptional", "signatures": [ { "name": "locatorForOptional", "entryType": "function", "description": "Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance\nor element under the root element of this `HarnessEnvironmnet`.\n\nFor example, given the following DOM and assuming `DivHarness.hostSelector` is `'div'`\n\n```html\n<div id=\"d1\"></div><div id=\"d2\"></div>\n```\n\nthen we expect:\n\n```ts\nawait lf.locatorForOptional(DivHarness, 'div')() // Gets a `DivHarness` instance for #d1\nawait lf.locatorForOptional('div', DivHarness)() // Gets a `TestElement` instance for #d1\nawait lf.locatorForOptional('span')() // Gets `null`\n```", "generics": [ { "name": "T", "constraint": "(HarnessQuery<any> | string)[]" } ], "isNewType": false, "jsdocTags": [ { "name": "param", "comment": "A list of queries specifying which harnesses and elements to search for:\n- A `string` searches for elements matching the CSS selector specified by the string.\n- A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\ngiven class.\n- A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\npredicate." }, { "name": "return", "comment": "An asynchronous locator function that searches for and returns a `Promise` for the\nfirst element or harness matching the given search criteria. Matches are ordered first by\norder in the DOM, and second by order in the queries list. If no matches are found, the\n`Promise` is resolved with `null`. The type that the `Promise` resolves to is a union of all\nresult types for each query or null." } ], "params": [ { "name": "queries", "description": "A list of queries specifying which harnesses and elements to search for:\n- A `string` searches for elements matching the CSS selector specified by the string.\n- A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\ngiven class.\n- A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\npredicate.", "type": "T", "isOptional": false, "isRestParam": true } ], "rawComment": "/**\n * Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance\n * or element under the root element of this `HarnessEnvironmnet`.\n *\n * For example, given the following DOM and assuming `DivHarness.hostSelector` is `'div'`\n *\n * ```html\n * <div id=\"d1\"></div><div id=\"d2\"></div>\n * ```\n *\n * then we expect:\n *\n * ```ts\n * await lf.locatorForOptional(DivHarness, 'div')() // Gets a `DivHarness` instance for #d1\n * await lf.locatorForOptional('div', DivHarness)() // Gets a `TestElement` instance for #d1\n * await lf.locatorForOptional('span')() // Gets `null`\n * ```\n *\n * @param queries A list of queries specifying which harnesses and elements to search for:\n * - A `string` searches for elements matching the CSS selector specified by the string.\n * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\n * given class.\n * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\n * predicate.\n * @return An asynchronous locator function that searches for and returns a `Promise` for the\n * first element or harness matching the given search criteria. Matches are ordered first by\n * order in the DOM, and second by order in the queries list. If no matches are found, the\n * `Promise` is resolved with `null`. The type that the `Promise` resolves to is a union of all\n * result types for each query or null.\n */", "returnType": "() => Promise<LocatorFnResult<T> | null>" } ], "implementation": { "params": [ { "name": "queries", "description": "A list of queries specifying which harnesses and elements to search for:\n- A `string` searches for elements matching the CSS selector specified by the string.\n- A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\ngiven class.\n- A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\npredicate.", "type": "T", "isOptional": false, "isRestParam": true } ], "isNewType": false, "returnType": "() => Promise<LocatorFnResult<T> | null>", "generics": [ { "name": "T", "constraint": "(HarnessQuery<any> | string)[]" } ], "name": "locatorForOptional", "description": "Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance\nor element under the root element of this `HarnessEnvironmnet`.\n\nFor example, given the following DOM and assuming `DivHarness.hostSelector` is `'div'`\n\n```html\n<div id=\"d1\"></div><div id=\"d2\"></div>\n```\n\nthen we expect:\n\n```ts\nawait lf.locatorForOptional(DivHarness, 'div')() // Gets a `DivHarness` instance for #d1\nawait lf.locatorForOptional('div', DivHarness)() // Gets a `TestElement` instance for #d1\nawait lf.locatorForOptional('span')() // Gets `null`\n```", "entryType": "function", "jsdocTags": [ { "name": "param", "comment": "A list of queries specifying which harnesses and elements to search for:\n- A `string` searches for elements matching the CSS selector specified by the string.\n- A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\ngiven class.\n- A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\npredicate." }, { "name": "return", "comment": "An asynchronous locator function that searches for and returns a `Promise` for the\nfirst element or harness matching the given search criteria. Matches are ordered first by\norder in the DOM, and second by order in the queries list. If no matches are found, the\n`Promise` is resolved with `null`. The type that the `Promise` resolves to is a union of all\nresult types for each query or null." } ], "rawComment": "/**\n * Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance\n * or element under the root element of this `HarnessEnvironmnet`.\n *\n * For example, given the following DOM and assuming `DivHarness.hostSelector` is `'div'`\n *\n * ```html\n * <div id=\"d1\"></div><div id=\"d2\"></div>\n * ```\n *\n * then we expect:\n *\n * ```ts\n * await lf.locatorForOptional(DivHarness, 'div')() // Gets a `DivHarness` instance for #d1\n * await lf.locatorForOptional('div', DivHarness)() // Gets a `TestElement` instance for #d1\n * await lf.locatorForOptional('span')() // Gets `null`\n * ```\n *\n * @param queries A list of queries specifying which harnesses and elements to search for:\n * - A `string` searches for elements matching the CSS selector specified by the string.\n * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\n * given class.\n * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\n * predicate.\n * @return An asynchronous locator function that searches for and returns a `Promise` for the\n * first element or harness matching the given search criteria. Matches are ordered first by\n * order in the DOM, and second by order in the queries list. If no matches are found, the\n * `Promise` is resolved with `null`. The type that the `Promise` resolves to is a union of all\n * result types for each query or null.\n */" }, "entryType": "function", "description": "Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance\nor element under the root element of this `HarnessEnvironmnet`.\n\nFor example, given the following DOM and assuming `DivHarness.hostSelector` is `'div'`\n\n```html\n<div id=\"d1\"></div><div id=\"d2\"></div>\n```\n\nthen we expect:\n\n```ts\nawait lf.locatorForOptional(DivHarness, 'div')() // Gets a `DivHarness` instance for #d1\nawait lf.locatorForOptional('div', DivHarness)() // Gets a `TestElement` instance for #d1\nawait lf.locatorForOptional('span')() // Gets `null`\n```", "jsdocTags": [ { "name": "param", "comment": "A list of queries specifying which harnesses and elements to search for:\n- A `string` searches for elements matching the CSS selector specified by the string.\n- A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\ngiven class.\n- A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\npredicate." }, { "name": "return", "comment": "An asynchronous locator function that searches for and returns a `Promise` for the\nfirst element or harness matching the given search criteria. Matches are ordered first by\norder in the DOM, and second by order in the queries list. If no matches are found, the\n`Promise` is resolved with `null`. The type that the `Promise` resolves to is a union of all\nresult types for each query or null." } ], "rawComment": "/**\n * Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance\n * or element under the root element of this `HarnessEnvironmnet`.\n *\n * For example, given the following DOM and assuming `DivHarness.hostSelector` is `'div'`\n *\n * ```html\n * <div id=\"d1\"></div><div id=\"d2\"></div>\n * ```\n *\n * then we expect:\n *\n * ```ts\n * await lf.locatorForOptional(DivHarness, 'div')() // Gets a `DivHarness` instance for #d1\n * await lf.locatorForOptional('div', DivHarness)() // Gets a `TestElement` instance for #d1\n * await lf.locatorForOptional('span')() // Gets `null`\n * ```\n *\n * @param queries A list of queries specifying which harnesses and elements to search for:\n * - A `string` searches for elements matching the CSS selector specified by the string.\n * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\n * given class.\n * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\n * predicate.\n * @return An asynchronous locator function that searches for and returns a `Promise` for the\n * first element or harness matching the given search criteria. Matches are ordered first by\n * order in the DOM, and second by order in the queries list. If no matches are found, the\n * `Promise` is resolved with `null`. The type that the `Promise` resolves to is a union of all\n * result types for each query or null.\n */", "memberType": "method", "memberTags": [] }, { "name": "locatorForAll", "signatures": [ { "name": "locatorForAll", "entryType": "function", "description": "Creates an asynchronous locator function that can be used to find `ComponentHarness` instances\nor elements under the root element of this `HarnessEnvironment`.\n\nFor example, given the following DOM and assuming `DivHarness.hostSelector` is `'div'` and\n`IdIsD1Harness.hostSelector` is `'#d1'`\n\n```html\n<div id=\"d1\"></div><div id=\"d2\"></div>\n```\n\nthen we expect:\n\n```ts\n// Gets [DivHarness for #d1, TestElement for #d1, DivHarness for #d2, TestElement for #d2]\nawait lf.locatorForAll(DivHarness, 'div')()\n// Gets [TestElement for #d1, TestElement for #d2]\nawait lf.locatorForAll('div', '#d1')()\n// Gets [DivHarness for #d1, IdIsD1Harness for #d1, DivHarness for #d2]\nawait lf.locatorForAll(DivHarness, IdIsD1Harness)()\n// Gets []\nawait lf.locatorForAll('span')()\n```", "generics": [ { "name": "T", "constraint": "(HarnessQuery<any> | string)[]" } ], "isNewType": false, "jsdocTags": [ { "name": "param", "comment": "A list of queries specifying which harnesses and elements to search for:\n- A `string` searches for elements matching the CSS selector specified by the string.\n- A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\ngiven class.\n- A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\npredicate." }, { "name": "return", "comment": "An asynchronous locator function that searches for and returns a `Promise` for all\nelements and harnesses matching the given search criteria. Matches are ordered first by\norder in the DOM, and second by order in the queries list. If an element matches more than\none `ComponentHarness` class, the locator gets an instance of each for the same element. If\nan element matches multiple `string` selectors, only one `TestElement` instance is returned\nfor that element. The type that the `Promise` resolves to is an array where each element is\nthe union of all result types for each query." } ], "params": [ { "name": "queries", "description": "A list of queries specifying which harnesses and elements to search for:\n- A `string` searches for elements matching the CSS selector specified by the string.\n- A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the\ngiven class.\n- A `HarnessPredicate` searches for `ComponentHarness` instances matching the given\npredicate.", "type": "T", "isOptional": false, "isRestParam": true } ], "rawComment": "/**\n * Creates an asynchronous locator function that can be used to find `ComponentHarness` instances\n * or elements under the root element of this `HarnessEnvironment`.\n *\n * For example, given the following DOM and assuming `DivHarness.hostSelector` is `'div'` and\n * `IdIsD1Harness.hostSelector` is `'#d1'`\n *\n * ```html\n * <div id=\"d1\"></div><div id=\"d2\"></div>\n * ```\n *\n * then we expect:\n *\n * ```ts\n * // Gets [DivHarness for #d1, TestElement for #d1, DivHarness for #d2, TestElement for #d2]\n * await lf.locatorForAll(DivHarness, 'div')()\n * // Gets [TestElement for #d1, TestElement for #d2]\n * await lf.locatorForAll('div', '#d1')()\n * // Gets [DivHarness for #d1, IdIsD1Harness for #d1, DivHarness for #d2]\n * a