import {MatButtonHarness} from '@angular/material/button/testing';
MatButtonHarness
extends
ContentContainerComponentHarness
Harness for interacting with a MDC-based mat-button in tests.
| Name | Description |
|---|---|
|
async
blur
|
|
|---|---|
|
Blurs the button and returns a void promise that indicates when the action is complete. |
|
| Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
async
click
|
|
|---|---|
|
Clicks the button at the given position relative to its top-left. |
|
| Parameters | |
|
relativeX number
|
The relative x position of the click. |
|
relativeY number
|
The relative y position of the click. |
| Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
async
click
|
|
|---|---|
|
Clicks the button at its center. |
|
| Parameters | |
|
location "center"
|
|
| Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
async
click
|
|
|---|---|
|
Clicks the button. |
|
| Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
async
focus
|
|
|---|---|
|
Focuses the button and returns a void promise that indicates when the action is complete. |
|
| Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
async
getAllChildLoaders
|
|
|---|---|
| Parameters | |
|
selector S
|
|
| Returns | |
Promise<HarnessLoader[]>
|
|
async
getAllHarnesses
|
|
|---|---|
| Parameters | |
|
query HarnessQuery<T>
|
|
| Returns | |
Promise<T[]>
|
|
async
getChildLoader
|
|
|---|---|
| Parameters | |
|
selector S
|
|
| Returns | |
Promise<HarnessLoader>
|
|
async
getHarness
|
|
|---|---|
| Parameters | |
|
query HarnessQuery<T>
|
|
| Returns | |
Promise<T>
|
|
async
getHarnessOrNull
|
|
|---|---|
| Parameters | |
|
query HarnessQuery<T>
|
|
| Returns | |
Promise<T | null>
|
|
async
getText
|
|
|---|---|
|
Gets a promise for the button's label text. |
|
| Returns | |
Promise<string>
|
|
async
getVariant
|
|
|---|---|
|
Gets the variant of the button. |
|
| Returns | |
Promise<ButtonVariant>
|
|
async
hasHarness
|
|
|---|---|
| Parameters | |
|
query HarnessQuery<T>
|
|
| Returns | |
Promise<boolean>
|
|
async
host
|
|
|---|---|
|
Gets a |
|
| Returns | |
Promise<TestElement>
|
|
async
isDisabled
|
|
|---|---|
|
Gets a boolean promise indicating if the button is disabled. |
|
| Returns | |
Promise<boolean>
|
|
async
isFocused
|
|
|---|---|
|
Whether the button is focused. |
|
| Returns | |
Promise<boolean>
|
|
static
with
|
|
|---|---|
|
Gets a |
|
| Parameters | |
|
options ButtonHarnessFilters = {}
|
Options for narrowing the search:
|
| Returns | |
HarnessPredicate<T>
|
a |
ButtonHarnessFilters
A set of criteria that can be used to filter a list of button harness instances.
| Name | Description |
|---|---|
|
Only find instances which match the given disabled state. |
|
Only find instances whose text matches the given value. |
|
Only find instances with a variant. |
ButtonVariant
Possible button appearances.
type ButtonVariant = 'basic' | 'raised' | 'flat' | 'icon' | 'stroked' | 'fab' | 'mini-fab';