UNPKG

4.5 kBTypeScriptView Raw
1import { BaseHarnessFilters } from '@angular/cdk/testing';
2import { ComponentHarness } from '@angular/cdk/testing';
3import { ContentContainerComponentHarness } from '@angular/cdk/testing';
4import { HarnessLoader } from '@angular/cdk/testing';
5import { HarnessPredicate } from '@angular/cdk/testing';
6
7export declare interface AccordionHarnessFilters extends BaseHarnessFilters {
8}
9
10export declare interface ExpansionPanelHarnessFilters extends BaseHarnessFilters {
11 title?: string | RegExp | null;
12 description?: string | RegExp | null;
13 content?: string | RegExp;
14 expanded?: boolean;
15 disabled?: boolean;
16}
17
18/** Harness for interacting with a standard mat-accordion in tests. */
19export declare class MatAccordionHarness extends ComponentHarness {
20 static hostSelector: string;
21 /**
22 * Gets a `HarnessPredicate` that can be used to search for an accordion
23 * with specific attributes.
24 * @param options Options for narrowing the search.
25 * @return a `HarnessPredicate` configured with the given options.
26 */
27 static with(options?: AccordionHarnessFilters): HarnessPredicate<MatAccordionHarness>;
28 /** Gets all expansion panels which are part of the accordion. */
29 getExpansionPanels(filter?: ExpansionPanelHarnessFilters): Promise<MatExpansionPanelHarness[]>;
30 /** Whether the accordion allows multiple expanded panels simultaneously. */
31 isMulti(): Promise<boolean>;
32}
33
34/** Harness for interacting with a standard mat-expansion-panel in tests. */
35export declare class MatExpansionPanelHarness extends ContentContainerComponentHarness<MatExpansionPanelSection> {
36 static hostSelector: string;
37 private _header;
38 private _title;
39 private _description;
40 private _expansionIndicator;
41 private _content;
42 /**
43 * Gets a `HarnessPredicate` that can be used to search for an expansion-panel
44 * with specific attributes.
45 * @param options Options for narrowing the search:
46 * - `title` finds an expansion-panel with a specific title text.
47 * - `description` finds an expansion-panel with a specific description text.
48 * - `expanded` finds an expansion-panel that is currently expanded.
49 * - `disabled` finds an expansion-panel that is disabled.
50 * @return a `HarnessPredicate` configured with the given options.
51 */
52 static with(options?: ExpansionPanelHarnessFilters): HarnessPredicate<MatExpansionPanelHarness>;
53 /** Whether the panel is expanded. */
54 isExpanded(): Promise<boolean>;
55 /**
56 * Gets the title text of the panel.
57 * @returns Title text or `null` if no title is set up.
58 */
59 getTitle(): Promise<string | null>;
60 /**
61 * Gets the description text of the panel.
62 * @returns Description text or `null` if no description is set up.
63 */
64 getDescription(): Promise<string | null>;
65 /** Whether the panel is disabled. */
66 isDisabled(): Promise<boolean>;
67 /**
68 * Toggles the expanded state of the panel by clicking on the panel
69 * header. This method will not work if the panel is disabled.
70 */
71 toggle(): Promise<void>;
72 /** Expands the expansion panel if collapsed. */
73 expand(): Promise<void>;
74 /** Collapses the expansion panel if expanded. */
75 collapse(): Promise<void>;
76 /** Gets the text content of the panel. */
77 getTextContent(): Promise<string>;
78 /**
79 * Gets a `HarnessLoader` that can be used to load harnesses for
80 * components within the panel's content area.
81 * @deprecated Use either `getChildLoader(MatExpansionPanelSection.CONTENT)`, `getHarness` or
82 * `getAllHarnesses` instead.
83 * @breaking-change 12.0.0
84 */
85 getHarnessLoaderForContent(): Promise<HarnessLoader>;
86 /** Focuses the panel. */
87 focus(): Promise<void>;
88 /** Blurs the panel. */
89 blur(): Promise<void>;
90 /** Whether the panel is focused. */
91 isFocused(): Promise<boolean>;
92 /** Whether the panel has a toggle indicator displayed. */
93 hasToggleIndicator(): Promise<boolean>;
94 /** Gets the position of the toggle indicator. */
95 getToggleIndicatorPosition(): Promise<'before' | 'after'>;
96}
97
98/** Selectors for the various `mat-expansion-panel` sections that may contain user content. */
99export declare const enum MatExpansionPanelSection {
100 HEADER = ".mat-expansion-panel-header",
101 TITLE = ".mat-expansion-panel-header-title",
102 DESCRIPTION = ".mat-expansion-panel-header-description",
103 CONTENT = ".mat-expansion-panel-content"
104}
105
106export { }