API reference for Angular Material button-toggle-testing

import {MatButtonToggleHarness} from '@angular/material/button-toggle/testing';

Harness for interacting with a standard mat-button-toggle in tests.

Methods
async
blur

Blurs the toggle.

Returns
Promise<void>

Promise that resolves when the action completes.

async
check

Puts the button toggle in a checked state by toggling it if it's currently unchecked, or doing nothing if it is already checked.

Returns
Promise<void>

Promise that resolves when the action completes.

async
focus

Focuses the toggle.

Returns
Promise<void>

Promise that resolves when the action completes.

async
getAppearance

Gets the appearance that the button toggle is using.

Returns
Promise<MatButtonToggleAppearance>

async
getAriaLabel

Gets a promise for the button toggle's aria-label.

Returns
Promise<string | null>

async
getAriaLabelledby

Gets a promise for the button toggles's aria-labelledby.

Returns
Promise<string | null>

async
getName

Gets a promise for the button toggle's name.

Returns
Promise<string | null>

async
getText

Gets a promise for the button toggle's text.

Returns
Promise<string>

async
host

Gets a Promise for the TestElement representing the host element of the component.

Returns
Promise<TestElement>

async
isChecked

Gets a boolean promise indicating if the button toggle is checked.

Returns
Promise<boolean>

async
isDisabled

Gets a boolean promise indicating if the button toggle is disabled.

Returns
Promise<boolean>

async
toggle

Toggle the checked state of the buttons toggle.

Returns
Promise<void>

Promise that resolves when the action completes.

async
uncheck

Puts the button toggle in an unchecked state by toggling it if it's currently checked, or doing nothing if it's already unchecked.

Returns
Promise<void>

Promise that resolves when the action completes.

Harness for interacting with a standard mat-button-toggle in tests.

Methods
async
getAppearance

Gets the appearance that the group is using.

Returns
Promise<MatButtonToggleAppearance>

async
getToggles

Gets the button toggles that are inside the group.

Parameters

filter

ButtonToggleHarnessFilters = {}

Optionally filters which toggles are included.

Returns
Promise<MatButtonToggleHarness[]>

async
host

Gets a Promise for the TestElement representing the host element of the component.

Returns
Promise<TestElement>

async
isDisabled

Gets whether the button toggle group is disabled.

Returns
Promise<boolean>

async
isVertical

Gets whether the button toggle group is laid out vertically.

Returns
Promise<boolean>

Criteria that can be used to filter a list of MatButtonToggleHarness instances.

Properties
Name Description

checked: boolean

Only find instances that are checked.

name: string | RegExp

Only find instances whose name matches the given value.

text: string | RegExp

Only find instances whose text matches the given value.

Criteria that can be used to filter a list of MatButtonToggleGroupHarness instances.