API reference for Angular Material autocomplete-testing

import {MatAutocompleteHarness} from '@angular/material/autocomplete/testing';

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

Methods
async
blur

Blurs the autocomplete input.

Returns
Promise<void>

Promise that resolves when the action completes.

async
enterText

Enters text into the autocomplete.

Parameters

value

string

Returns
Promise<void>

Promise that resolves when the action completes.

async
focus

Focuses the autocomplete input.

Returns
Promise<void>

Promise that resolves when the action completes.

async
getOptionGroups

Gets the option groups inside the autocomplete panel.

Parameters

filters

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

Returns
Promise<MatOptgroupHarness[]>

async
getOptions

Gets the options inside the autocomplete panel.

Parameters

filters

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

Returns
Promise<MatOptionHarness[]>

async
getValue

Gets the value of the autocomplete input.

Returns
Promise<string>

async
host

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

Returns
Promise<TestElement>

async
isDisabled

Whether the autocomplete input is disabled.

Returns
Promise<boolean>

async
isOpen

Whether the autocomplete is open.

Returns
Promise<boolean>

async
selectOption

Selects the first option matching the given filters.

Parameters

filters

OptionHarnessFilters

Returns
Promise<void>

Promise that resolves when the action completes.

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

Properties
Name Description

value: string | RegExp

Only find instances whose associated input element matches the given value.