API reference for Angular Material select-testing

import {MatSelectHarness} from '@angular/material/select/testing';

Harness for interacting with a standard mat-select in tests.

Methods
async
blur

Blurs the select and returns a void promise that indicates when the action is complete.

Returns
Promise<void>

Promise that resolves when the action completes.

async
clickOptions

Clicks the options that match the passed-in filter. If the select is in multi-selection mode all options will be clicked, otherwise the harness will pick the first matching option.

Parameters

filter

OptionHarnessFilters = {}

Returns
Promise<void>

Promise that resolves when the action completes.

async
close

Closes the select's panel.

Returns
Promise<void>

Promise that resolves when the action completes.

async
focus

Focuses the select and returns a void promise that indicates when the action is complete.

Returns
Promise<void>

Promise that resolves when the action completes.

async
getOptionGroups

Gets the groups of options inside the panel.

Parameters

filter

Pick<OptgroupHarnessFilters, "selector" | "labelText"> = {}

Returns
Promise<MatOptgroupHarness[]>

async
getOptions

Gets the options inside the select panel.

Parameters

filter

Pick<OptionHarnessFilters, "text" | "isSelected" | "selector"> = {}

Returns
Promise<MatOptionHarness[]>

async
getValueText

Gets a promise for the select's value text.

Returns
Promise<string>

async
host

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

Returns
Promise<TestElement>

async
isDisabled

Gets a boolean promise indicating if the select is disabled.

Returns
Promise<boolean>

async
isEmpty

Gets a boolean promise indicating if the select is empty (no value is selected).

Returns
Promise<boolean>

async
isMultiple

Gets a boolean promise indicating if the select is in multi-selection mode.

Returns
Promise<boolean>

async
isOpen

Gets whether the select is open.

Returns
Promise<boolean>

async
isRequired

Gets a boolean promise indicating if the select is required.

Returns
Promise<boolean>

async
isValid

Gets a boolean promise indicating if the select is valid.

Returns
Promise<boolean>

async
open

Opens the select's panel.

Returns
Promise<void>

Promise that resolves when the action completes.

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