/** * @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 { MatLegacyListHarnessBase } from './list-harness-base'; import { getListItemPredicate, MatLegacyListItemHarnessBase } from './list-item-harness-base'; /** * Harness for interacting with a standard mat-nav-list in tests. * @deprecated Use `MatNavListHarness` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. * @breaking-change 17.0.0 */ export class MatLegacyNavListHarness extends MatLegacyListHarnessBase { constructor() { super(...arguments); this._itemHarness = MatLegacyNavListItemHarness; } /** The selector for the host element of a `MatNavList` instance. */ static { this.hostSelector = '.mat-nav-list'; } /** * Gets a `HarnessPredicate` that can be used to search for a `MatNavListHarness` that meets * certain criteria. * @param options Options for filtering which nav list instances are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(options = {}) { return new HarnessPredicate(MatLegacyNavListHarness, options); } } /** * Harness for interacting with a nav list item. * @deprecated Use `MatNavListItemHarness` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. * @breaking-change 17.0.0 */ export class MatLegacyNavListItemHarness extends MatLegacyListItemHarnessBase { /** The selector for the host element of a `MatListItem` instance. */ static { this.hostSelector = `${MatLegacyNavListHarness.hostSelector} .mat-list-item`; } /** * Gets a `HarnessPredicate` that can be used to search for a `MatNavListItemHarness` that * meets certain criteria. * @param options Options for filtering which nav list item instances are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(options = {}) { return getListItemPredicate(MatLegacyNavListItemHarness, options).addOption('href', options.href, async (harness, href) => HarnessPredicate.stringMatches(harness.getHref(), href)); } /** Gets the href for this nav list item. */ async getHref() { return (await this.host()).getAttribute('href'); } /** Clicks on the nav list item. */ async click() { return (await this.host()).click(); } /** Focuses the nav list item. */ async focus() { return (await this.host()).focus(); } /** Blurs the nav list item. */ async blur() { return (await this.host()).blur(); } /** Whether the nav list item is focused. */ async isFocused() { return (await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