/** * @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 { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing'; /** * Harness for interacting with a standard Angular Material tab link in tests. * @deprecated Use `MatTabLinkHarness` from `@angular/material/tabs/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. * @breaking-change 17.0.0 */ export class MatLegacyTabLinkHarness extends ComponentHarness { /** The selector for the host element of a `MatTabLink` instance. */ static { this.hostSelector = '.mat-tab-link'; } /** * Gets a `HarnessPredicate` that can be used to search for a `MatTabLinkHarness` that meets * certain criteria. * @param options Options for filtering which tab link instances are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(options = {}) { return new HarnessPredicate(MatLegacyTabLinkHarness, options).addOption('label', options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label)); } /** Gets the label of the link. */ async getLabel() { return (await this.host()).text(); } /** Whether the link is active. */ async isActive() { const host = await this.host(); return host.hasClass('mat-tab-label-active'); } /** Whether the link is disabled. */ async isDisabled() { const host = await this.host(); return host.hasClass('mat-tab-disabled'); } /** Clicks on the link. */ async click() { await (await this.host()).click(); } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFiLWxpbmstaGFybmVzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC9sZWdhY3ktdGFicy90ZXN0aW5nL3RhYi1saW5rLWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLGdCQUFnQixFQUFFLGdCQUFnQixFQUFDLE1BQU0sc0JBQXNCLENBQUM7QUFHeEU7Ozs7R0FJRztBQUNILE1BQU0sT0FBTyx1QkFBd0IsU0FBUSxnQkFBZ0I7SUFDM0Qsb0VBQW9FO2F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