source: trip-planner-front/node_modules/@angular/cdk/testing/harness-environment.d.ts@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 3.4 KB
Line 
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 */
8import { AsyncFactoryFn, ComponentHarness, ComponentHarnessConstructor, HarnessLoader, HarnessQuery, LocatorFactory, LocatorFnResult } from './component-harness';
9import { TestElement } from './test-element';
10/**
11 * Base harness environment class that can be extended to allow `ComponentHarness`es to be used in
12 * different test environments (e.g. testbed, protractor, etc.). This class implements the
13 * functionality of both a `HarnessLoader` and `LocatorFactory`. This class is generic on the raw
14 * element type, `E`, used by the particular test environment.
15 */
16export declare abstract class HarnessEnvironment<E> implements HarnessLoader, LocatorFactory {
17 protected rawRootElement: E;
18 rootElement: TestElement;
19 protected constructor(rawRootElement: E);
20 documentRootLocatorFactory(): LocatorFactory;
21 locatorFor<T extends (HarnessQuery<any> | string)[]>(...queries: T): AsyncFactoryFn<LocatorFnResult<T>>;
22 locatorForOptional<T extends (HarnessQuery<any> | string)[]>(...queries: T): AsyncFactoryFn<LocatorFnResult<T> | null>;
23 locatorForAll<T extends (HarnessQuery<any> | string)[]>(...queries: T): AsyncFactoryFn<LocatorFnResult<T>[]>;
24 rootHarnessLoader(): Promise<HarnessLoader>;
25 harnessLoaderFor(selector: string): Promise<HarnessLoader>;
26 harnessLoaderForOptional(selector: string): Promise<HarnessLoader | null>;
27 harnessLoaderForAll(selector: string): Promise<HarnessLoader[]>;
28 getHarness<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<T>;
29 getAllHarnesses<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<T[]>;
30 getChildLoader(selector: string): Promise<HarnessLoader>;
31 getAllChildLoaders(selector: string): Promise<HarnessLoader[]>;
32 /** Creates a `ComponentHarness` for the given harness type with the given raw host element. */
33 protected createComponentHarness<T extends ComponentHarness>(harnessType: ComponentHarnessConstructor<T>, element: E): T;
34 abstract forceStabilize(): Promise<void>;
35 abstract waitForTasksOutsideAngular(): Promise<void>;
36 /** Gets the root element for the document. */
37 protected abstract getDocumentRoot(): E;
38 /** Creates a `TestElement` from a raw element. */
39 protected abstract createTestElement(element: E): TestElement;
40 /** Creates a `HarnessLoader` rooted at the given raw element. */
41 protected abstract createEnvironment(element: E): HarnessEnvironment<E>;
42 /**
43 * Gets a list of all elements matching the given selector under this environment's root element.
44 */
45 protected abstract getAllRawElements(selector: string): Promise<E[]>;
46 /**
47 * Matches the given raw elements with the given list of element and harness queries to produce a
48 * list of matched harnesses and test elements.
49 */
50 private _getAllHarnessesAndTestElements;
51 /**
52 * Check whether the given query matches the given element, if it does return the matched
53 * `TestElement` or `ComponentHarness`, if it does not, return null. In cases where the caller
54 * knows for sure that the query matches the element's selector, `skipSelectorCheck` can be used
55 * to skip verification and optimize performance.
56 */
57 private _getQueryResultForElement;
58}
Note: See TracBrowser for help on using the repository browser.