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