/** * @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, parallel, } from '@angular/cdk/testing'; import { MatFooterRowHarness, MatHeaderRowHarness, MatRowHarness, } from './row-harness'; export class _MatTableHarnessBase extends ContentContainerComponentHarness { /** Gets all of the header rows in a table. */ async getHeaderRows(filter = {}) { return this.locatorForAll(this._headerRowHarness.with(filter))(); } /** Gets all of the regular data rows in a table. */ async getRows(filter = {}) { return this.locatorForAll(this._rowHarness.with(filter))(); } /** Gets all of the footer rows in a table. */ async getFooterRows(filter = {}) { return this.locatorForAll(this._footerRowHarness.with(filter))(); } /** Gets the text inside the entire table organized by rows. */ async getCellTextByIndex() { const rows = await this.getRows(); return parallel(() => rows.map(row => row.getCellTextByIndex())); } /** Gets the text inside the entire table organized by columns. */ async getCellTextByColumnName() { const [headerRows, footerRows, dataRows] = await parallel(() => [ this.getHeaderRows(), this.getFooterRows(), this.getRows(), ]); const text = {}; const [headerData, footerData, rowsData] = await parallel(() => [ parallel(() => headerRows.map(row => row.getCellTextByColumnName())), parallel(() => footerRows.map(row => row.getCellTextByColumnName())), parallel(() => dataRows.map(row => row.getCellTextByColumnName())), ]); rowsData.forEach(data => { Object.keys(data).forEach(columnName => { const cellText = data[columnName]; if (!text[columnName]) { text[columnName] = { headerText: getCellTextsByColumn(headerData, columnName), footerText: getCellTextsByColumn(footerData, columnName), text: [], }; } text[columnName].text.push(cellText); }); }); return text; } } /** Harness for interacting with an MDC-based mat-table in tests. */ export class MatTableHarness extends _MatTableHarnessBase { constructor() { super(...arguments); this._headerRowHarness = MatHeaderRowHarness; this._rowHarness = MatRowHarness; this._footerRowHarness = MatFooterRowHarness; } /** The selector for the host element of a `MatTableHarness` instance. */ static { this.hostSelector = '.mat-mdc-table'; } /** * Gets a `HarnessPredicate` that can be used to search for a table with specific attributes. * @param options Options for narrowing the search * @return a `HarnessPredicate` configured with the given options. */ static with(options = {}) { return new HarnessPredicate(this, options); } } /** Extracts the text of cells only under a particular column. */ function getCellTextsByColumn(rowsData, column) { const columnTexts = []; rowsData.forEach(data => { Object.keys(data).forEach(columnName => { if (columnName === column) { columnTexts.push(data[columnName]); } }); }); return columnTexts; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFibGUtaGFybmVzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC90YWJsZS90ZXN0aW5nL3RhYmxlLWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUdMLGdDQUFnQyxFQUNoQyxnQkFBZ0IsRUFDaEIsUUFBUSxHQUNULE1BQU0sc0JBQXNCLENBQUM7QUFDOUIsT0FBTyxFQUNMLG1CQUFtQixFQUNuQixtQkFBbUIsRUFDbkIsYUFBYSxHQUVkLE1BQU0sZUFBZSxDQUFDO0FBaUJ2QixNQUFNLE9BQWdCLG9CQWFwQixTQUFRLGdDQUF3QztJQUtoRCw4Q0FBOEM7SUFDOUMsS0FBSyxDQUFDLGFBQWEsQ0FBQyxTQUE0QixFQUFFO1FBQ2hELE9BQU8sSUFBSSxDQUFDLGFBQWEsQ0FBQyxJQUFJLENBQUMsaUJBQWlCLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUFDLEVBQUUsQ0FBQztJQUNuRSxDQUFDO0lBRUQsb0RBQW9EO0lBQ3BELEtBQUssQ0FBQyxPQUFPLENBQUMsU0FBNEIsRUFBRTtRQUMxQyxPQUFPLElBQUksQ0FBQyxhQUFhLENBQUMsSUFBSSxDQUFDLFdBQVcsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLENBQUMsRUFBRSxDQUFDO0lBQzdELENBQUM7SUFFRCw4Q0FBOEM7SUFDOUMsS0FBSyxD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