Skip to content

docs(cdk/testing): document TestElement methods #21103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/cdk/testing/test-harnesses.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ The functions created with the locator methods described above all return `TestE
| `getDimensions(): Promise<ElementDimensions>` | Gets the dimensions of the element. |
| `getProperty(name: string): Promise<any>` | Gets the value of the given JS property for the element. |
| `matchesSelector(selector: string): Promise<boolean>` | Checks whether the element matches the given CSS selector. |
| `setInputValue(value: string): Promise<void>;` | Sets the value of a property of an input. |
| `selectOptions(...optionIndexes: number[]): Promise<void>;` | Selects the options at the specified indexes inside of a native `select` element. |
| `dispatchEvent(name: string, data?: Record<string, EventData>): Promise<void>;` | Dispatches an event with a particular name. |

`TestElement` is an abstraction designed to work across different test environments (Karma,
Protractor, etc). When using harnesses, you should perform all DOM interaction via this interface.
Expand Down Expand Up @@ -599,6 +602,9 @@ result of the operation.
| `getDimensions(): Promise<ElementDimensions>` | Gets the dimensions of the element. |
| `getProperty(name: string): Promise<any>` | Gets the value of the given property for the element. |
| `matchesSelector(selector: string): Promise<boolean>` | Checks whether the given selector matches the element. |
| `setInputValue(value: string): Promise<void>;` | Sets the value of a property of an input. |
| `selectOptions(...optionIndexes: number[]): Promise<void>;` | Selects the options at the specified indexes inside of a native `select` element. |
| `dispatchEvent(name: string, data?: Record<string, EventData>): Promise<void>;` | Dispatches an event with a particular name. |

The `TestElement` interface consists largely of methods that resemble methods
available on `HTMLElement`; similar methods exist in most test environments, which makes
Expand Down