MCPcopy Create free account
hub / github.com/angular/components / TestElement

Interface TestElement

src/cdk/testing/test-element.ts:75–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73 * interface through which the ComponentHarness interacts with the component's DOM.
74 */
75export interface TestElement {
76 /** Blur the element. */
77 blur(): Promise<void>;
78
79 /** Clear the element's input (for input and textarea elements only). */
80 clear(): Promise<void>;
81
82 /**
83 * Click the element at the default location for the current environment. If you need to guarantee
84 * the element is clicked at a specific location, consider using `click('center')` or
85 * `click(x, y)` instead.
86 */
87 click(modifiers?: ModifierKeys): Promise<void>;
88
89 /** Click the element at the element's center. */
90 click(location: 'center', modifiers?: ModifierKeys): Promise<void>;
91
92 /**
93 * Click the element at the specified coordinates relative to the top-left of the element.
94 * @param relativeX Coordinate within the element, along the X-axis at which to click.
95 * @param relativeY Coordinate within the element, along the Y-axis at which to click.
96 * @param modifiers Modifier keys held while clicking
97 */
98 click(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;
99
100 /**
101 * Right clicks on the element at the specified coordinates relative to the top-left of it.
102 * @param relativeX Coordinate within the element, along the X-axis at which to click.
103 * @param relativeY Coordinate within the element, along the Y-axis at which to click.
104 * @param modifiers Modifier keys held while clicking
105 */
106 rightClick(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;
107
108 /** Focus the element. */
109 focus(): Promise<void>;
110
111 /** Get the computed value of the given CSS property for the element. */
112 getCssValue(property: string): Promise<string>;
113
114 /** Hovers the mouse over the element. */
115 hover(): Promise<void>;
116
117 /** Moves the mouse away from the element. */
118 mouseAway(): Promise<void>;
119
120 /**
121 * Sends the given string to the input as a series of key presses. Also fires input events
122 * and attempts to add the string to the Element's value. Note that some environments cannot
123 * reproduce native browser behavior for keyboard shortcuts such as Tab, Ctrl + A, etc.
124 * @throws An error if no keys have been specified.
125 */
126 sendKeys(...keys: (string | TestKey)[]): Promise<void>;
127
128 /**
129 * Sends the given string to the input as a series of key presses. Also fires input
130 * events and attempts to add the string to the Element's value.
131 * @throws An error if no keys have been specified.
132 */

Callers 117

initFocusTrapMethod · 0.65
blurMethod · 0.65
blurMethod · 0.65
addMethod · 0.65
ngOnDestroyMethod · 0.65
selectMethod · 0.65
addMethod · 0.65

Implementers 3

ProtractorElementsrc/cdk/testing/protractor/protractor-
SeleniumWebDriverElementsrc/cdk/testing/selenium-webdriver/sel
UnitTestElementsrc/cdk/testing/testbed/unit-test-elem

Calls

no outgoing calls

Tested by

no test coverage detected