Skip to content

Commit 941a864

Browse files
yjaaidimmalerba
authored andcommitted
docs(cdk/testing): document TestElement methods (#21103)
Add missing documentation for freshly added methods: `setInputValue`, `selectOptions` & `dispatchEvent`. (cherry picked from commit 2d9a656)
1 parent b1ec656 commit 941a864

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/cdk/testing/test-harnesses.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ The functions created with the locator methods described above all return `TestE
299299
| `getDimensions(): Promise<ElementDimensions>` | Gets the dimensions of the element. |
300300
| `getProperty(name: string): Promise<any>` | Gets the value of the given JS property for the element. |
301301
| `matchesSelector(selector: string): Promise<boolean>` | Checks whether the element matches the given CSS selector. |
302+
| `setInputValue(value: string): Promise<void>;` | Sets the value of a property of an input. |
303+
| `selectOptions(...optionIndexes: number[]): Promise<void>;` | Selects the options at the specified indexes inside of a native `select` element. |
304+
| `dispatchEvent(name: string, data?: Record<string, EventData>): Promise<void>;` | Dispatches an event with a particular name. |
302305

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

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

0 commit comments

Comments
 (0)