[6a3a178] | 1 | /**
|
---|
| 2 | * @license
|
---|
| 3 | * Copyright Google LLC All Rights Reserved.
|
---|
| 4 | *
|
---|
| 5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 6 | * found in the LICENSE file at https://angular.io/license
|
---|
| 7 | */
|
---|
| 8 | import { __awaiter } from "tslib";
|
---|
| 9 | import { ContentContainerComponentHarness, HarnessPredicate, parallel, } from '@angular/cdk/testing';
|
---|
| 10 | import { MatRowHarness, MatHeaderRowHarness, MatFooterRowHarness, } from './row-harness';
|
---|
| 11 | export class _MatTableHarnessBase extends ContentContainerComponentHarness {
|
---|
| 12 | /** Gets all of the header rows in a table. */
|
---|
| 13 | getHeaderRows(filter = {}) {
|
---|
| 14 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 15 | return this.locatorForAll(this._headerRowHarness.with(filter))();
|
---|
| 16 | });
|
---|
| 17 | }
|
---|
| 18 | /** Gets all of the regular data rows in a table. */
|
---|
| 19 | getRows(filter = {}) {
|
---|
| 20 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 21 | return this.locatorForAll(this._rowHarness.with(filter))();
|
---|
| 22 | });
|
---|
| 23 | }
|
---|
| 24 | /** Gets all of the footer rows in a table. */
|
---|
| 25 | getFooterRows(filter = {}) {
|
---|
| 26 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 27 | return this.locatorForAll(this._footerRowHarness.with(filter))();
|
---|
| 28 | });
|
---|
| 29 | }
|
---|
| 30 | /** Gets the text inside the entire table organized by rows. */
|
---|
| 31 | getCellTextByIndex() {
|
---|
| 32 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 33 | const rows = yield this.getRows();
|
---|
| 34 | return parallel(() => rows.map(row => row.getCellTextByIndex()));
|
---|
| 35 | });
|
---|
| 36 | }
|
---|
| 37 | /** Gets the text inside the entire table organized by columns. */
|
---|
| 38 | getCellTextByColumnName() {
|
---|
| 39 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 40 | const [headerRows, footerRows, dataRows] = yield parallel(() => [
|
---|
| 41 | this.getHeaderRows(),
|
---|
| 42 | this.getFooterRows(),
|
---|
| 43 | this.getRows()
|
---|
| 44 | ]);
|
---|
| 45 | const text = {};
|
---|
| 46 | const [headerData, footerData, rowsData] = yield parallel(() => [
|
---|
| 47 | parallel(() => headerRows.map(row => row.getCellTextByColumnName())),
|
---|
| 48 | parallel(() => footerRows.map(row => row.getCellTextByColumnName())),
|
---|
| 49 | parallel(() => dataRows.map(row => row.getCellTextByColumnName())),
|
---|
| 50 | ]);
|
---|
| 51 | rowsData.forEach(data => {
|
---|
| 52 | Object.keys(data).forEach(columnName => {
|
---|
| 53 | const cellText = data[columnName];
|
---|
| 54 | if (!text[columnName]) {
|
---|
| 55 | text[columnName] = {
|
---|
| 56 | headerText: getCellTextsByColumn(headerData, columnName),
|
---|
| 57 | footerText: getCellTextsByColumn(footerData, columnName),
|
---|
| 58 | text: []
|
---|
| 59 | };
|
---|
| 60 | }
|
---|
| 61 | text[columnName].text.push(cellText);
|
---|
| 62 | });
|
---|
| 63 | });
|
---|
| 64 | return text;
|
---|
| 65 | });
|
---|
| 66 | }
|
---|
| 67 | }
|
---|
| 68 | /** Harness for interacting with a standard mat-table in tests. */
|
---|
| 69 | export class MatTableHarness extends _MatTableHarnessBase {
|
---|
| 70 | constructor() {
|
---|
| 71 | super(...arguments);
|
---|
| 72 | this._headerRowHarness = MatHeaderRowHarness;
|
---|
| 73 | this._rowHarness = MatRowHarness;
|
---|
| 74 | this._footerRowHarness = MatFooterRowHarness;
|
---|
| 75 | }
|
---|
| 76 | /**
|
---|
| 77 | * Gets a `HarnessPredicate` that can be used to search for a table with specific attributes.
|
---|
| 78 | * @param options Options for narrowing the search
|
---|
| 79 | * @return a `HarnessPredicate` configured with the given options.
|
---|
| 80 | */
|
---|
| 81 | static with(options = {}) {
|
---|
| 82 | return new HarnessPredicate(MatTableHarness, options);
|
---|
| 83 | }
|
---|
| 84 | }
|
---|
| 85 | /** The selector for the host element of a `MatTableHarness` instance. */
|
---|
| 86 | MatTableHarness.hostSelector = '.mat-table';
|
---|
| 87 | /** Extracts the text of cells only under a particular column. */
|
---|
| 88 | function getCellTextsByColumn(rowsData, column) {
|
---|
| 89 | const columnTexts = [];
|
---|
| 90 | rowsData.forEach(data => {
|
---|
| 91 | Object.keys(data).forEach(columnName => {
|
---|
| 92 | if (columnName === column) {
|
---|
| 93 | columnTexts.push(data[columnName]);
|
---|
| 94 | }
|
---|
| 95 | });
|
---|
| 96 | });
|
---|
| 97 | return columnTexts;
|
---|
| 98 | }
|
---|
| 99 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFibGUtaGFybmVzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC90YWJsZS90ZXN0aW5nL3RhYmxlLWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOztBQUVILE9BQU8sRUFHTCxnQ0FBZ0MsRUFDaEMsZ0JBQWdCLEVBQ2hCLFFBQVEsR0FDVCxNQUFNLHNCQUFzQixDQUFDO0FBRTlCLE9BQU8sRUFDTCxhQUFhLEVBQ2IsbUJBQW1CLEVBQ25CLG1CQUFtQixHQUVwQixNQUFNLGVBQWUsQ0FBQztBQWdCdkIsTUFBTSxPQUFnQixvQkFVcEIsU0FBUSxnQ0FBd0M7SUFLaEQsOENBQThDO0lBQ3hDLGFBQWEsQ0FBQyxTQUE0QixFQUFFOztZQUNoRCxPQUFPLElBQUksQ0FBQyxhQUFhLENBQUMsSUFBSSxDQUFDLGlCQUFpQixDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsQ0FBQyxFQUFFLENBQUM7UUFDbkUsQ0FBQztLQUFBO0lBRUQsb0RBQW9EO0lBQzlDLE9BQU8sQ0FBQyxTQUE0QixFQUFFOztZQUMxQyxPQUFPL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