/** * @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 { ContentContainerComponentHarness, HarnessPredicate } from '@angular/cdk/testing'; /** Harness for interacting with a standard `MatGridTitle` in tests. */ export class MatGridTileHarness extends ContentContainerComponentHarness { constructor() { super(...arguments); this._header = this.locatorForOptional(".mat-grid-tile-header" /* MatGridTileSection.HEADER */); this._footer = this.locatorForOptional(".mat-grid-tile-footer" /* MatGridTileSection.FOOTER */); this._avatar = this.locatorForOptional('.mat-grid-avatar'); } /** The selector for the host element of a `MatGridTile` instance. */ static { this.hostSelector = '.mat-grid-tile'; } /** * Gets a `HarnessPredicate` that can be used to search for a `MatGridTileHarness` * that meets certain criteria. * @param options Options for filtering which dialog instances are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(options = {}) { return new HarnessPredicate(MatGridTileHarness, options) .addOption('headerText', options.headerText, (harness, pattern) => HarnessPredicate.stringMatches(harness.getHeaderText(), pattern)) .addOption('footerText', options.footerText, (harness, pattern) => HarnessPredicate.stringMatches(harness.getFooterText(), pattern)); } /** Gets the amount of rows that the grid-tile takes up. */ async getRowspan() { return Number(await (await this.host()).getAttribute('rowspan')); } /** Gets the amount of columns that the grid-tile takes up. */ async getColspan() { return Number(await (await this.host()).getAttribute('colspan')); } /** Whether the grid-tile has a header. */ async hasHeader() { return (await this._header()) !== null; } /** Whether the grid-tile has a footer. */ async hasFooter() { return (await this._footer()) !== null; } /** Whether the grid-tile has an avatar. */ async hasAvatar() { return (await this._avatar()) !== null; } /** Gets the text of the header if present. */ async getHeaderText() { // For performance reasons, we do not use "hasHeader" as // we would then need to query twice for the header. const headerEl = await this._header(); return headerEl ? headerEl.text() : null; } /** Gets the text of the footer if present. */ async getFooterText() { // For performance reasons, we do not use "hasFooter" as // we would then need to query twice for the footer. const headerEl = await this._footer(); return headerEl ? headerEl.text() : null; } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxl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