{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/sort/testing/sort-header-harness.ts","../../../../../../../src/material/sort/testing/sort-harness.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing';\nimport {SortDirection} from '@angular/material/sort';\nimport {SortHeaderHarnessFilters} from './sort-harness-filters';\n\n/** Harness for interacting with a standard Angular Material sort header in tests. */\nexport class MatSortHeaderHarness extends ComponentHarness {\n static hostSelector = '.mat-sort-header';\n private _container = this.locatorFor('.mat-sort-header-container');\n\n /**\n * Gets a `HarnessPredicate` that can be used to\n * search for a sort header with specific attributes.\n */\n static with(options: SortHeaderHarnessFilters = {}): HarnessPredicate {\n return new HarnessPredicate(MatSortHeaderHarness, options)\n .addOption('label', options.label, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getLabel(), label),\n )\n .addOption('sortDirection', options.sortDirection, (harness, sortDirection) => {\n return HarnessPredicate.stringMatches(harness.getSortDirection(), sortDirection);\n });\n }\n\n /** Gets the label of the sort header. */\n async getLabel(): Promise {\n return (await this._container()).text();\n }\n\n /** Gets the sorting direction of the header. */\n async getSortDirection(): Promise {\n const host = await this.host();\n const ariaSort = await host.getAttribute('aria-sort');\n\n if (ariaSort === 'ascending') {\n return 'asc';\n } else if (ariaSort === 'descending') {\n return 'desc';\n }\n\n return '';\n }\n\n /** Gets whether the sort header is currently being sorted by. */\n async isActive(): Promise {\n return !!(await this.getSortDirection());\n }\n\n /** Whether the sort header is disabled. */\n async isDisabled(): Promise {\n return (await this.host()).hasClass('mat-sort-header-disabled');\n }\n\n /** Clicks the header to change its sorting direction. Only works if the header is enabled. */\n async click(): Promise {\n return (await this.host()).click();\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing';\nimport {SortHarnessFilters, SortHeaderHarnessFilters} from './sort-harness-filters';\nimport {MatSortHeaderHarness} from './sort-header-harness';\n\n/** Harness for interacting with a standard `mat-sort` in tests. */\nexport class MatSortHarness extends ComponentHarness {\n static hostSelector = '.mat-sort';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `mat-sort` with specific attributes.\n * @param options Options for narrowing the search.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: SortHarnessFilters = {}): HarnessPredicate {\n return new HarnessPredicate(MatSortHarness, options);\n }\n\n /** Gets all of the sort headers in the `mat-sort`. */\n async getSortHeaders(filter: SortHeaderHarnessFilters = {}): Promise {\n return this.locatorForAll(MatSortHeaderHarness.with(filter))();\n }\n\n /** Gets the selected header in the `mat-sort`. */\n async getActiveHeader(): Promise {\n const headers = await this.getSortHeaders();\n for (let i = 0; i < headers.length; i++) {\n if (await headers[i].isActive()) {\n return headers[i];\n }\n }\n return null;\n }\n}\n"],"names":[],"mappings":";;AAYA;AACM,MAAO,oBAAqB,SAAQ,gBAAgB,CAAA;AAA1D,IAAA,WAAA,GAAA;;AAEU,QAAA,IAAA,CAAA,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,4BAA4B,CAAC,CAAC;KAiDpE;aAlDQ,IAAY,CAAA,YAAA,GAAG,kBAAH,CAAsB,EAAA;AAGzC;;;AAGG;AACH,IAAA,OAAO,IAAI,CAAC,OAAA,GAAoC,EAAE,EAAA;AAChD,QAAA,OAAO,IAAI,gBAAgB,CAAC,oBAAoB,EAAE,OAAO,CAAC;aACvD,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,KAChD,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CAC1D;AACA,aAAA,SAAS,CAAC,eAAe,EAAE,OAAO,CAAC,aAAa,EAAE,CAA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