import {MatMenuHarness} from '@angular/material/menu/testing';
MatMenuHarness
extends
ComponentHarness
Harness for interacting with a standard mat-menu in tests.
async
blur
|
|
---|---|
Blurs the menu. |
|
Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
async
clickItem
|
|
---|---|
Clicks an item in the menu, and optionally continues clicking items in subsequent sub-menus. |
|
Parameters | |
itemFilter Pick<MenuItemHarnessFilters, "text" | "selector" | "hasSubmenu">
|
A filter used to represent which item in the menu should be clicked. The first matching menu item will be clicked. |
subItemFilters
|
A list of filters representing the items to click in any subsequent
sub-menus. The first item in the sub-menu matching the corresponding filter in
|
...subItemFilters Pick<MenuItemHarnessFilters, "text" | "selector" | "hasSubmenu">[]
|
|
Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
async
close
|
|
---|---|
Closes the menu. |
|
Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
async
focus
|
|
---|---|
Focuses the menu. |
|
Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
async
getItems
|
|
---|---|
Gets a list of |
|
Parameters | |
filters Pick<MenuItemHarnessFilters, "text" | "selector" | "hasSubmenu"> = {}
|
Optionally filters which menu items are included. |
Returns | |
Promise<MatMenuItemHarness[]>
|
|
async
getTriggerText
|
|
---|---|
Gets the text of the menu's trigger element. |
|
Returns | |
Promise<string>
|
|
async
host
|
|
---|---|
Gets a |
|
Returns | |
Promise<TestElement>
|
|
async
isDisabled
|
|
---|---|
Whether the menu is disabled. |
|
Returns | |
Promise<boolean>
|
|
async
isOpen
|
|
---|---|
Whether the menu is open. |
|
Returns | |
Promise<boolean>
|
|
async
open
|
|
---|---|
Opens the menu. |
|
Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
MatMenuItemHarness
extends
ComponentHarness
Harness for interacting with a standard mat-menu-item in tests.
async
blur
|
|
---|---|
Blurs the menu item. |
|
Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
async
click
|
|
---|---|
Clicks the menu item. |
|
Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
async
focus
|
|
---|---|
Focuses the menu item. |
|
Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
async
getSubmenu
|
|
---|---|
Gets the submenu associated with this menu item, or null if none. |
|
Returns | |
Promise<MatMenuHarness | null>
|
|
async
getText
|
|
---|---|
Gets the text of the menu item. |
|
Returns | |
Promise<string>
|
|
async
hasSubmenu
|
|
---|---|
Whether this item has a submenu. |
|
Returns | |
Promise<boolean>
|
|
async
host
|
|
---|---|
Gets a |
|
Returns | |
Promise<TestElement>
|
|
async
isDisabled
|
|
---|---|
Whether the menu is disabled. |
|
Returns | |
Promise<boolean>
|
|
MenuHarnessFilters
A set of criteria that can be used to filter a list of MatMenuHarness
instances.
Name | Description |
---|---|
|
Only find instances whose trigger text matches the given value. |
MenuItemHarnessFilters
A set of criteria that can be used to filter a list of MatMenuItemHarness
instances.
Name | Description |
---|---|
|
Only find instances that have a sub-menu. |
|
Only find instances whose text matches the given value. |