import {MatSnackBarHarness} from '@angular/material/snack-bar/testing';
MatSnackBarHarness
extends
ContentContainerComponentHarness
Harness for interacting with a standard mat-snack-bar in tests.
Name | Description |
---|---|
|
The selector for the host element of a |
async
dismissWithAction
|
|
---|---|
Dismisses the snack-bar by clicking the action button. Method cannot be used for snack-bar's without action or with custom content. |
|
Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
async
getActionDescription
|
|
---|---|
Gets the description of the snack-bar. Method cannot be used for snack-bar's without action or with custom content. |
|
Returns | |
Promise<string>
|
|
async
getAllChildLoaders
|
|
---|---|
Parameters | |
selector S
|
|
Returns | |
Promise<HarnessLoader[]>
|
|
async
getAllHarnesses
|
|
---|---|
Parameters | |
query HarnessQuery<T>
|
|
Returns | |
Promise<T[]>
|
|
async
getAriaLive
|
|
---|---|
Gets the aria-live of the snack-bar's live region. The aria-live of a snack-bar is determined based on the ARIA politeness specified in the snack-bar config. |
|
Returns | |
Promise<AriaLivePoliteness>
|
|
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
getMessage
|
|
---|---|
Gets the message of the snack-bar. Method cannot be used for snack-bar's with custom content. |
|
Returns | |
Promise<string>
|
|
async
hasAction
|
|
---|---|
Whether the snack-bar has an action. Method cannot be used for snack-bar's with custom content. |
|
Returns | |
Promise<boolean>
|
|
async
hasHarness
|
|
---|---|
Parameters | |
query HarnessQuery<T>
|
|
Returns | |
Promise<boolean>
|
|
async
host
|
|
---|---|
Gets a |
|
Returns | |
Promise<TestElement>
|
|
async
isDismissed
|
|
---|---|
Gets whether the snack-bar has been dismissed. |
|
Returns | |
Promise<boolean>
|
|
static
with
|
|
---|---|
Gets a |
|
Parameters | |
options SnackBarHarnessFilters = {}
|
Options for filtering which snack bar instances are considered a match. |
Returns | |
HarnessPredicate<MatSnackBarHarness>
|
a |
Deprecated
async
getRole
|
|
---|---|
Gets the role of the snack-bar. The role of a snack-bar is determined based on the ARIA politeness specified in the snack-bar config. |
|
Returns | |
Promise<'alert' | 'status' | null>
|
|
SnackBarHarnessFilters
A set of criteria that can be used to filter a list of MatSnackBarHarness
instances.