/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/material/sort/testing/sort-harness.ts
41 строка
1 KB
Naji
docs: replace angular.io links with angular.dev (#29734)
19 сен 2024, 13:57
Не верифицирован
19 сен 2024, 13:57
5782834
Код
Авторство
О чём код?
/** * @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.dev/license */ import {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing'; import {SortHarnessFilters, SortHeaderHarnessFilters} from './sort-harness-filters'; import {MatSortHeaderHarness} from './sort-header-harness'; /** Harness for interacting with a standard `mat-sort` in tests. */ export class MatSortHarness extends ComponentHarness { static hostSelector = '.mat-sort'; /** * Gets a `HarnessPredicate` that can be used to search for a `mat-sort` with specific attributes. * @param options Options for narrowing the search. * @return a `HarnessPredicate` configured with the given options. */ static with(options: SortHarnessFilters = {}): HarnessPredicate<MatSortHarness> { return new HarnessPredicate(MatSortHarness, options); } /** Gets all of the sort headers in the `mat-sort`. */ async getSortHeaders(filter: SortHeaderHarnessFilters = {}): Promise<MatSortHeaderHarness[]> { return this.locatorForAll(MatSortHeaderHarness.with(filter))(); } /** Gets the selected header in the `mat-sort`. */ async getActiveHeader(): Promise<MatSortHeaderHarness | null> { const headers = await this.getSortHeaders(); for (let i = 0; i < headers.length; i++) { if (await headers[i].isActive()) { return headers[i]; } } return null; } }