API reference for Angular Material slide-toggle-testing

import {MatSlideToggleHarness} from '@angular/material/slide-toggle/testing';

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

Methods
async
blur

Blurs the slide-toggle.

Returns
Promise<void>

Promise that resolves when the action completes.

async
check

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

Returns
Promise<void>

Promise that resolves when the action completes.

async
focus

Focuses the slide-toggle.

Returns
Promise<void>

Promise that resolves when the action completes.

async
getAriaLabel

Gets the slide-toggle's aria-label.

Returns
Promise<string | null>

async
getAriaLabelledby

Gets the slide-toggle's aria-labelledby.

Returns
Promise<string | null>

async
getLabelText

Gets the slide-toggle's label text.

Returns
Promise<string>

async
getName

Gets the slide-toggle's name.

Returns
Promise<string | null>

async
host

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

Returns
Promise<TestElement>

async
isChecked

Whether the slide-toggle is checked.

Returns
Promise<boolean>

async
isDisabled

Whether the slide-toggle is disabled.

Returns
Promise<boolean>

async
isRequired

Whether the slide-toggle is required.

Returns
Promise<boolean>

async
isValid

Whether the slide-toggle is valid.

Returns
Promise<boolean>

async
toggle

Toggle the checked state of the slide-toggle.

Returns
Promise<void>

Promise that resolves when the action completes.

async
uncheck

Puts the slide-toggle in an unchecked state by toggling it if it is currently checked, or doing nothing if it is already unchecked.

Returns
Promise<void>

Promise that resolves when the action completes.

A set of criteria that can be used to filter a list of MatSlideToggleHarness instances.

Properties
Name Description

label: string | RegExp

Only find instances whose label matches the given value.

name: string

Only find instances whose name is the given value.