API reference for Angular Material bottom-sheet-testing

import {MatBottomSheetHarness} from '@angular/material/bottom-sheet/testing';

Harness for interacting with a standard MatBottomSheet in tests.

Properties
Name Description

static hostSelector: '.mat-bottom-sheet-container'

Methods
async
dismiss

Dismisses the bottom sheet by pressing escape. Note that this method cannot be used if "disableClose" has been set to true via the config.

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
getAriaLabel

Gets the value of the bottom sheet's "aria-label" attribute.

Returns
Promise<string | null>

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
hasHarness
Parameters

query

HarnessQuery<T>

Returns
Promise<boolean>

async
host

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

Returns
Promise<TestElement>

static
with

Gets a HarnessPredicate that can be used to search for a bottom sheet with specific attributes.

Parameters

options

BottomSheetHarnessFilters = {}

Options for narrowing the search.

Returns
HarnessPredicate<MatBottomSheetHarness>

a HarnessPredicate configured with the given options.