[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 { ComponentHarness, ComponentHarnessConstructor, HarnessPredicate } from '@angular/cdk/testing';
|
---|
| 9 | import { DividerHarnessFilters, MatDividerHarness } from '@angular/material/divider/testing';
|
---|
| 10 | import { BaseListItemHarnessFilters, SubheaderHarnessFilters } from './list-harness-filters';
|
---|
| 11 | import { MatSubheaderHarness } from './list-item-harness-base';
|
---|
| 12 | /** Represents a section of a list falling under a specific header. */
|
---|
| 13 | export interface ListSection<I> {
|
---|
| 14 | /** The heading for this list section. `undefined` if there is no heading. */
|
---|
| 15 | heading?: string;
|
---|
| 16 | /** The items in this list section. */
|
---|
| 17 | items: I[];
|
---|
| 18 | }
|
---|
| 19 | /**
|
---|
| 20 | * Shared behavior among the harnesses for the various `MatList` flavors.
|
---|
| 21 | * @template T A constructor type for a list item harness type used by this list harness.
|
---|
| 22 | * @template C The list item harness type that `T` constructs.
|
---|
| 23 | * @template F The filter type used filter list item harness of type `C`.
|
---|
| 24 | * @docs-private
|
---|
| 25 | */
|
---|
| 26 | export declare abstract class MatListHarnessBase<T extends (ComponentHarnessConstructor<C> & {
|
---|
| 27 | with: (options?: F) => HarnessPredicate<C>;
|
---|
| 28 | }), C extends ComponentHarness, F extends BaseListItemHarnessFilters> extends ComponentHarness {
|
---|
| 29 | protected _itemHarness: T;
|
---|
| 30 | /**
|
---|
| 31 | * Gets a list of harnesses representing the items in this list.
|
---|
| 32 | * @param filters Optional filters used to narrow which harnesses are included
|
---|
| 33 | * @return The list of items matching the given filters.
|
---|
| 34 | */
|
---|
| 35 | getItems(filters?: F): Promise<C[]>;
|
---|
| 36 | /**
|
---|
| 37 | * Gets a list of `ListSection` representing the list items grouped by subheaders. If the list has
|
---|
| 38 | * no subheaders it is represented as a single `ListSection` with an undefined `heading` property.
|
---|
| 39 | * @param filters Optional filters used to narrow which list item harnesses are included
|
---|
| 40 | * @return The list of items matching the given filters, grouped into sections by subheader.
|
---|
| 41 | */
|
---|
| 42 | getItemsGroupedBySubheader(filters?: F): Promise<ListSection<C>[]>;
|
---|
| 43 | /**
|
---|
| 44 | * Gets a list of sub-lists representing the list items grouped by dividers. If the list has no
|
---|
| 45 | * dividers it is represented as a list with a single sub-list.
|
---|
| 46 | * @param filters Optional filters used to narrow which list item harnesses are included
|
---|
| 47 | * @return The list of items matching the given filters, grouped into sub-lists by divider.
|
---|
| 48 | */
|
---|
| 49 | getItemsGroupedByDividers(filters?: F): Promise<C[][]>;
|
---|
| 50 | /**
|
---|
| 51 | * Gets a list of harnesses representing all of the items, subheaders, and dividers
|
---|
| 52 | * (in the order they appear in the list). Use `instanceof` to check which type of harness a given
|
---|
| 53 | * item is.
|
---|
| 54 | * @param filters Optional filters used to narrow which list items, subheaders, and dividers are
|
---|
| 55 | * included. A value of `false` for the `item`, `subheader`, or `divider` properties indicates
|
---|
| 56 | * that the respective harness type should be omitted completely.
|
---|
| 57 | * @return The list of harnesses representing the items, subheaders, and dividers matching the
|
---|
| 58 | * given filters.
|
---|
| 59 | */
|
---|
| 60 | getItemsWithSubheadersAndDividers(filters: {
|
---|
| 61 | item: false;
|
---|
| 62 | subheader: false;
|
---|
| 63 | divider: false;
|
---|
| 64 | }): Promise<[]>;
|
---|
| 65 | getItemsWithSubheadersAndDividers(filters: {
|
---|
| 66 | item?: F | false;
|
---|
| 67 | subheader: false;
|
---|
| 68 | divider: false;
|
---|
| 69 | }): Promise<C[]>;
|
---|
| 70 | getItemsWithSubheadersAndDividers(filters: {
|
---|
| 71 | item: false;
|
---|
| 72 | subheader?: SubheaderHarnessFilters | false;
|
---|
| 73 | divider: false;
|
---|
| 74 | }): Promise<MatSubheaderHarness[]>;
|
---|
| 75 | getItemsWithSubheadersAndDividers(filters: {
|
---|
| 76 | item: false;
|
---|
| 77 | subheader: false;
|
---|
| 78 | divider?: DividerHarnessFilters | false;
|
---|
| 79 | }): Promise<MatDividerHarness[]>;
|
---|
| 80 | getItemsWithSubheadersAndDividers(filters: {
|
---|
| 81 | item?: F | false;
|
---|
| 82 | subheader?: SubheaderHarnessFilters | false;
|
---|
| 83 | divider: false;
|
---|
| 84 | }): Promise<(C | MatSubheaderHarness)[]>;
|
---|
| 85 | getItemsWithSubheadersAndDividers(filters: {
|
---|
| 86 | item?: F | false;
|
---|
| 87 | subheader: false;
|
---|
| 88 | divider?: false | DividerHarnessFilters;
|
---|
| 89 | }): Promise<(C | MatDividerHarness)[]>;
|
---|
| 90 | getItemsWithSubheadersAndDividers(filters: {
|
---|
| 91 | item: false;
|
---|
| 92 | subheader?: false | SubheaderHarnessFilters;
|
---|
| 93 | divider?: false | DividerHarnessFilters;
|
---|
| 94 | }): Promise<(MatSubheaderHarness | MatDividerHarness)[]>;
|
---|
| 95 | getItemsWithSubheadersAndDividers(filters?: {
|
---|
| 96 | item?: F | false;
|
---|
| 97 | subheader?: SubheaderHarnessFilters | false;
|
---|
| 98 | divider?: DividerHarnessFilters | false;
|
---|
| 99 | }): Promise<(C | MatSubheaderHarness | MatDividerHarness)[]>;
|
---|
| 100 | }
|
---|