/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { HarnessPredicate } from '@angular/cdk/testing'; import { _MatMenuHarnessBase, _MatMenuItemHarnessBase, } from '@angular/material/menu/testing'; /** * Harness for interacting with a standard mat-menu in tests. * @deprecated Use `MatMenuHarness` from `@angular/material/menu/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. * @breaking-change 17.0.0 */ export class MatLegacyMenuHarness extends _MatMenuHarnessBase { constructor() { super(...arguments); this._itemClass = MatLegacyMenuItemHarness; } /** The selector for the host element of a `MatMenu` instance. */ static { this.hostSelector = '.mat-menu-trigger'; } /** * Gets a `HarnessPredicate` that can be used to search for a `MatMenuHarness` that meets certain * criteria. * @param options Options for filtering which menu instances are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(options = {}) { return new HarnessPredicate(MatLegacyMenuHarness, options).addOption('triggerText', options.triggerText, (harness, text) => HarnessPredicate.stringMatches(harness.getTriggerText(), text)); } } /** * Harness for interacting with a standard mat-menu-item in tests. * @deprecated Use `MatMenuItemHarness` from `@angular/material/menu/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. * @breaking-change 17.0.0 */ export class MatLegacyMenuItemHarness extends _MatMenuItemHarnessBase { constructor() { super(...arguments); this._menuClass = MatLegacyMenuHarness; } /** The selector for the host element of a `MatMenuItem` instance. */ static { this.hostSelector = '.mat-menu-item'; } /** * Gets a `HarnessPredicate` that can be used to search for a `MatMenuItemHarness` that meets * certain criteria. * @param options Options for filtering which menu item instances are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(options = {}) { return new HarnessPredicate(MatLegacyMenuItemHarness, options) .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text)) .addOption('hasSubmenu', options.hasSubmenu, async (harness, hasSubmenu) => (await harness.hasSubmenu()) === hasSubmenu); } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlI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