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 { ElementDimensions, ModifierKeys, TestElement, TestKey, TextOptions, EventData } from '@angular/cdk/testing';
|
---|
9 | /** A `TestElement` implementation for unit tests. */
|
---|
10 | export declare class UnitTestElement implements TestElement {
|
---|
11 | readonly element: Element;
|
---|
12 | private _stabilize;
|
---|
13 | constructor(element: Element, _stabilize: () => Promise<void>);
|
---|
14 | /** Blur the element. */
|
---|
15 | blur(): Promise<void>;
|
---|
16 | /** Clear the element's input (for input and textarea elements only). */
|
---|
17 | clear(): Promise<void>;
|
---|
18 | /**
|
---|
19 | * Click the element at the default location for the current environment. If you need to guarantee
|
---|
20 | * the element is clicked at a specific location, consider using `click('center')` or
|
---|
21 | * `click(x, y)` instead.
|
---|
22 | */
|
---|
23 | click(modifiers?: ModifierKeys): Promise<void>;
|
---|
24 | /** Click the element at the element's center. */
|
---|
25 | click(location: 'center', modifiers?: ModifierKeys): Promise<void>;
|
---|
26 | /**
|
---|
27 | * Click the element at the specified coordinates relative to the top-left of the element.
|
---|
28 | * @param relativeX Coordinate within the element, along the X-axis at which to click.
|
---|
29 | * @param relativeY Coordinate within the element, along the Y-axis at which to click.
|
---|
30 | * @param modifiers Modifier keys held while clicking
|
---|
31 | */
|
---|
32 | click(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;
|
---|
33 | /**
|
---|
34 | * Right clicks on the element at the specified coordinates relative to the top-left of it.
|
---|
35 | * @param relativeX Coordinate within the element, along the X-axis at which to click.
|
---|
36 | * @param relativeY Coordinate within the element, along the Y-axis at which to click.
|
---|
37 | * @param modifiers Modifier keys held while clicking
|
---|
38 | */
|
---|
39 | rightClick(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;
|
---|
40 | /** Focus the element. */
|
---|
41 | focus(): Promise<void>;
|
---|
42 | /** Get the computed value of the given CSS property for the element. */
|
---|
43 | getCssValue(property: string): Promise<string>;
|
---|
44 | /** Hovers the mouse over the element. */
|
---|
45 | hover(): Promise<void>;
|
---|
46 | /** Moves the mouse away from the element. */
|
---|
47 | mouseAway(): Promise<void>;
|
---|
48 | /**
|
---|
49 | * Sends the given string to the input as a series of key presses. Also fires input events
|
---|
50 | * and attempts to add the string to the Element's value.
|
---|
51 | */
|
---|
52 | sendKeys(...keys: (string | TestKey)[]): Promise<void>;
|
---|
53 | /**
|
---|
54 | * Sends the given string to the input as a series of key presses. Also fires input events
|
---|
55 | * and attempts to add the string to the Element's value.
|
---|
56 | */
|
---|
57 | sendKeys(modifiers: ModifierKeys, ...keys: (string | TestKey)[]): Promise<void>;
|
---|
58 | /**
|
---|
59 | * Gets the text from the element.
|
---|
60 | * @param options Options that affect what text is included.
|
---|
61 | */
|
---|
62 | text(options?: TextOptions): Promise<string>;
|
---|
63 | /** Gets the value for the given attribute from the element. */
|
---|
64 | getAttribute(name: string): Promise<string | null>;
|
---|
65 | /** Checks whether the element has the given class. */
|
---|
66 | hasClass(name: string): Promise<boolean>;
|
---|
67 | /** Gets the dimensions of the element. */
|
---|
68 | getDimensions(): Promise<ElementDimensions>;
|
---|
69 | /** Gets the value of a property of an element. */
|
---|
70 | getProperty<T = any>(name: string): Promise<T>;
|
---|
71 | /** Sets the value of a property of an input. */
|
---|
72 | setInputValue(value: string): Promise<void>;
|
---|
73 | /** Selects the options at the specified indexes inside of a native `select` element. */
|
---|
74 | selectOptions(...optionIndexes: number[]): Promise<void>;
|
---|
75 | /** Checks whether this element matches the given selector. */
|
---|
76 | matchesSelector(selector: string): Promise<boolean>;
|
---|
77 | /** Checks whether the element is focused. */
|
---|
78 | isFocused(): Promise<boolean>;
|
---|
79 | /**
|
---|
80 | * Dispatches an event with a particular name.
|
---|
81 | * @param name Name of the event to be dispatched.
|
---|
82 | */
|
---|
83 | dispatchEvent(name: string, data?: Record<string, EventData>): Promise<void>;
|
---|
84 | /**
|
---|
85 | * Dispatches a pointer event on the current element if the browser supports it.
|
---|
86 | * @param name Name of the pointer event to be dispatched.
|
---|
87 | * @param clientX Coordinate of the user's pointer along the X axis.
|
---|
88 | * @param clientY Coordinate of the user's pointer along the Y axis.
|
---|
89 | * @param button Mouse button that should be pressed when dispatching the event.
|
---|
90 | */
|
---|
91 | private _dispatchPointerEventIfSupported;
|
---|
92 | /** Dispatches all the events that are part of a mouse event sequence. */
|
---|
93 | private _dispatchMouseEventSequence;
|
---|
94 | }
|
---|