/** * @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, parallel, } from '@angular/cdk/testing'; import { MatCellHarness, MatFooterCellHarness, MatHeaderCellHarness, } from './cell-harness'; export class _MatRowHarnessBase extends ComponentHarness { /** Gets a list of `MatCellHarness` for all cells in the row. */ async getCells(filter = {}) { return this.locatorForAll(this._cellHarness.with(filter))(); } /** Gets the text of the cells in the row. */ async getCellTextByIndex(filter = {}) { const cells = await this.getCells(filter); return parallel(() => cells.map(cell => cell.getText())); } /** Gets the text inside the row organized by columns. */ async getCellTextByColumnName() { const output = {}; const cells = await this.getCells(); const cellsData = await parallel(() => cells.map(cell => { return parallel(() => [cell.getColumnName(), cell.getText()]); })); cellsData.forEach(([columnName, text]) => (output[columnName] = text)); return output; } } /** Harness for interacting with an MDC-based Angular Material table row. */ export class MatRowHarness extends _MatRowHarnessBase { constructor() { super(...arguments); this._cellHarness = MatCellHarness; } /** The selector for the host element of a `MatRowHarness` instance. */ static { this.hostSelector = '.mat-mdc-row'; } /** * Gets a `HarnessPredicate` that can be used to search for a table row 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); } } /** Harness for interacting with an MDC-based Angular Material table header row. */ export class MatHeaderRowHarness extends _MatRowHarnessBase { constructor() { super(...arguments); this._cellHarness = MatHeaderCellHarness; } /** The selector for the host element of a `MatHeaderRowHarness` instance. */ static { this.hostSelector = '.mat-mdc-header-row'; } /** * Gets a `HarnessPredicate` that can be used to search for a table header row 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); } } /** Harness for interacting with an MDC-based Angular Material table footer row. */ export class MatFooterRowHarness extends _MatRowHarnessBase { constructor() { super(...arguments); this._cellHarness = MatFooterCellHarness; } /** The selector for the host element of a `MatFooterRowHarness` instance. */ static { this.hostSelector = '.mat-mdc-footer-row'; } /** * Gets a `HarnessPredicate` that can be used to search for a table footer row cell 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); } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm93LWhhcm5lc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwvdGFibGUvdGVzdGluZy9yb3ctaGFybmVzcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxPQUFPLEVBQ0wsZ0JBQWdCLEVBRWhCLGdCQUFnQixFQUNoQixRQUFRLEdBQ1QsTUFBTSxzQkFBc0IsQ0FBQztBQUM5QixPQUFPLEVBRUwsY0FBYyxFQUNkLG9CQUFvQixFQUNwQixvQkFBb0IsR0FDckIsTUFBTSxnQkFBZ0IsQ0FBQztBQVF4QixNQUFNLE9BQWdCLGtCQUtwQixTQUFRLGdCQUFnQjtJQUd4QixnRUFBZ0U7SUFDaEUsS0FBSyxDQUFDLFFBQVEsQ0FBQyxTQUE2QixFQUFFO1FBQzVDLE9BQU8sSUFBSSxDQUFDLGFBQWEsQ0FBQyxJQUFJLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsQ0FBQyxFQUFFLENBQUM7SUFDOUQsQ0FBQztJQUVELDZDQUE2QztJQUM3QyxLQUFLLENBQUMsa0JBQWtCLENBQUMsU0FBNkIsRUFBRTtRQUN0RCxNQUFNLEtBQUssR0FBRyxNQUFNLElBQUksQ0FBQyxRQUFRLENBQUMsTUFBTSxDQUFDLENBQUM7UUFDMUMsT0FBTyxRQUFRLENBQUMsR0FBRyxFQUFFLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDLElBQUksQ0F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