/** * @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, ContentContainerComponentHarness } from '@angular/cdk/testing'; /** * Harness for interacting with a standard mat-card in tests. * @deprecated Use `MatCardHarness` from `@angular/material/card/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. * @breaking-change 17.0.0 */ export class MatLegacyCardHarness extends ContentContainerComponentHarness { constructor() { super(...arguments); this._title = this.locatorForOptional('.mat-card-title'); this._subtitle = this.locatorForOptional('.mat-card-subtitle'); } /** The selector for the host element of a `MatCard` instance. */ static { this.hostSelector = '.mat-card'; } /** * Gets a `HarnessPredicate` that can be used to search for a `MatCardHarness` that meets * certain criteria. * @param options Options for filtering which card instances are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(options = {}) { return new HarnessPredicate(MatLegacyCardHarness, options) .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text)) .addOption('title', options.title, (harness, title) => HarnessPredicate.stringMatches(harness.getTitleText(), title)) .addOption('subtitle', options.subtitle, (harness, subtitle) => HarnessPredicate.stringMatches(harness.getSubtitleText(), subtitle)); } /** Gets all of the card's content as text. */ async getText() { return (await this.host()).text(); } /** Gets the cards's title text. */ async getTitleText() { return (await this._title())?.text() ?? ''; } /** Gets the cards's subtitle text. */ async getSubtitleText() { return (await this._subtitle())?.text() ?? ''; } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FyZC1oYXJuZXNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL2xlZ2FjeS1jYXJkL3Rlc3RpbmcvY2FyZC1oYXJuZXNzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sRUFBQyxnQkFBZ0IsRUFBRSxnQ0FBZ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