source: trip-planner-front/node_modules/@angular/material/menu/testing/menu-harness.d.ts@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 4.8 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { BaseHarnessFilters, ComponentHarness, ComponentHarnessConstructor, ContentContainerComponentHarness, HarnessLoader, HarnessPredicate } from '@angular/cdk/testing';
9import { MenuHarnessFilters, MenuItemHarnessFilters } from './menu-harness-filters';
10export declare abstract class _MatMenuHarnessBase<ItemType extends (ComponentHarnessConstructor<Item> & {
11 with: (options?: ItemFilters) => HarnessPredicate<Item>;
12}), Item extends ComponentHarness & {
13 click(): Promise<void>;
14 getSubmenu(): Promise<_MatMenuHarnessBase<ItemType, Item, ItemFilters> | null>;
15}, ItemFilters extends BaseHarnessFilters> extends ContentContainerComponentHarness<string> {
16 private _documentRootLocator;
17 protected abstract _itemClass: ItemType;
18 /** Whether the menu is disabled. */
19 isDisabled(): Promise<boolean>;
20 /** Whether the menu is open. */
21 isOpen(): Promise<boolean>;
22 /** Gets the text of the menu's trigger element. */
23 getTriggerText(): Promise<string>;
24 /** Focuses the menu. */
25 focus(): Promise<void>;
26 /** Blurs the menu. */
27 blur(): Promise<void>;
28 /** Whether the menu is focused. */
29 isFocused(): Promise<boolean>;
30 /** Opens the menu. */
31 open(): Promise<void>;
32 /** Closes the menu. */
33 close(): Promise<void>;
34 /**
35 * Gets a list of `MatMenuItemHarness` representing the items in the menu.
36 * @param filters Optionally filters which menu items are included.
37 */
38 getItems(filters?: Omit<ItemFilters, 'ancestor'>): Promise<Item[]>;
39 /**
40 * Clicks an item in the menu, and optionally continues clicking items in subsequent sub-menus.
41 * @param itemFilter A filter used to represent which item in the menu should be clicked. The
42 * first matching menu item will be clicked.
43 * @param subItemFilters A list of filters representing the items to click in any subsequent
44 * sub-menus. The first item in the sub-menu matching the corresponding filter in
45 * `subItemFilters` will be clicked.
46 */
47 clickItem(itemFilter: Omit<ItemFilters, 'ancestor'>, ...subItemFilters: Omit<ItemFilters, 'ancestor'>[]): Promise<void>;
48 protected getRootHarnessLoader(): Promise<HarnessLoader>;
49 /** Gets the menu panel associated with this menu. */
50 private _getMenuPanel;
51 /** Gets the id of the menu panel associated with this menu. */
52 private _getPanelId;
53}
54export declare abstract class _MatMenuItemHarnessBase<MenuType extends ComponentHarnessConstructor<Menu>, Menu extends ComponentHarness> extends ContentContainerComponentHarness<string> {
55 protected abstract _menuClass: MenuType;
56 /** Whether the menu is disabled. */
57 isDisabled(): Promise<boolean>;
58 /** Gets the text of the menu item. */
59 getText(): Promise<string>;
60 /** Focuses the menu item. */
61 focus(): Promise<void>;
62 /** Blurs the menu item. */
63 blur(): Promise<void>;
64 /** Whether the menu item is focused. */
65 isFocused(): Promise<boolean>;
66 /** Clicks the menu item. */
67 click(): Promise<void>;
68 /** Whether this item has a submenu. */
69 hasSubmenu(): Promise<boolean>;
70 /** Gets the submenu associated with this menu item, or null if none. */
71 getSubmenu(): Promise<Menu | null>;
72}
73/** Harness for interacting with a standard mat-menu in tests. */
74export declare class MatMenuHarness extends _MatMenuHarnessBase<typeof MatMenuItemHarness, MatMenuItemHarness, MenuItemHarnessFilters> {
75 /** The selector for the host element of a `MatMenu` instance. */
76 static hostSelector: string;
77 protected _itemClass: typeof MatMenuItemHarness;
78 /**
79 * Gets a `HarnessPredicate` that can be used to search for a `MatMenuHarness` that meets certain
80 * criteria.
81 * @param options Options for filtering which menu instances are considered a match.
82 * @return a `HarnessPredicate` configured with the given options.
83 */
84 static with(options?: MenuHarnessFilters): HarnessPredicate<MatMenuHarness>;
85}
86/** Harness for interacting with a standard mat-menu-item in tests. */
87export declare class MatMenuItemHarness extends _MatMenuItemHarnessBase<typeof MatMenuHarness, MatMenuHarness> {
88 /** The selector for the host element of a `MatMenuItem` instance. */
89 static hostSelector: string;
90 protected _menuClass: typeof MatMenuHarness;
91 /**
92 * Gets a `HarnessPredicate` that can be used to search for a `MatMenuItemHarness` that meets
93 * certain criteria.
94 * @param options Options for filtering which menu item instances are considered a match.
95 * @return a `HarnessPredicate` configured with the given options.
96 */
97 static with(options?: MenuItemHarnessFilters): HarnessPredicate<MatMenuItemHarness>;
98}
Note: See TracBrowser for help on using the repository browser.