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, } from '@angular/cdk/testing';
|
---|
10 | /** Harness for interacting with a standard mat-expansion-panel in tests. */
|
---|
11 | export class MatExpansionPanelHarness extends ContentContainerComponentHarness {
|
---|
12 | constructor() {
|
---|
13 | super(...arguments);
|
---|
14 | this._header = this.locatorFor(".mat-expansion-panel-header" /* HEADER */);
|
---|
15 | this._title = this.locatorForOptional(".mat-expansion-panel-header-title" /* TITLE */);
|
---|
16 | this._description = this.locatorForOptional(".mat-expansion-panel-header-description" /* DESCRIPTION */);
|
---|
17 | this._expansionIndicator = this.locatorForOptional('.mat-expansion-indicator');
|
---|
18 | this._content = this.locatorFor(".mat-expansion-panel-content" /* CONTENT */);
|
---|
19 | }
|
---|
20 | /**
|
---|
21 | * Gets a `HarnessPredicate` that can be used to search for an expansion-panel
|
---|
22 | * with specific attributes.
|
---|
23 | * @param options Options for narrowing the search:
|
---|
24 | * - `title` finds an expansion-panel with a specific title text.
|
---|
25 | * - `description` finds an expansion-panel with a specific description text.
|
---|
26 | * - `expanded` finds an expansion-panel that is currently expanded.
|
---|
27 | * - `disabled` finds an expansion-panel that is disabled.
|
---|
28 | * @return a `HarnessPredicate` configured with the given options.
|
---|
29 | */
|
---|
30 | static with(options = {}) {
|
---|
31 | return new HarnessPredicate(MatExpansionPanelHarness, options)
|
---|
32 | .addOption('title', options.title, (harness, title) => HarnessPredicate.stringMatches(harness.getTitle(), title))
|
---|
33 | .addOption('description', options.description, (harness, description) => HarnessPredicate.stringMatches(harness.getDescription(), description))
|
---|
34 | .addOption('content', options.content, (harness, content) => HarnessPredicate.stringMatches(harness.getTextContent(), content))
|
---|
35 | .addOption('expanded', options.expanded, (harness, expanded) => __awaiter(this, void 0, void 0, function* () { return (yield harness.isExpanded()) === expanded; }))
|
---|
36 | .addOption('disabled', options.disabled, (harness, disabled) => __awaiter(this, void 0, void 0, function* () { return (yield harness.isDisabled()) === disabled; }));
|
---|
37 | }
|
---|
38 | /** Whether the panel is expanded. */
|
---|
39 | isExpanded() {
|
---|
40 | return __awaiter(this, void 0, void 0, function* () {
|
---|
41 | return (yield this.host()).hasClass('mat-expanded');
|
---|
42 | });
|
---|
43 | }
|
---|
44 | /**
|
---|
45 | * Gets the title text of the panel.
|
---|
46 | * @returns Title text or `null` if no title is set up.
|
---|
47 | */
|
---|
48 | getTitle() {
|
---|
49 | return __awaiter(this, void 0, void 0, function* () {
|
---|
50 | const titleEl = yield this._title();
|
---|
51 | return titleEl ? titleEl.text() : null;
|
---|
52 | });
|
---|
53 | }
|
---|
54 | /**
|
---|
55 | * Gets the description text of the panel.
|
---|
56 | * @returns Description text or `null` if no description is set up.
|
---|
57 | */
|
---|
58 | getDescription() {
|
---|
59 | return __awaiter(this, void 0, void 0, function* () {
|
---|
60 | const descriptionEl = yield this._description();
|
---|
61 | return descriptionEl ? descriptionEl.text() : null;
|
---|
62 | });
|
---|
63 | }
|
---|
64 | /** Whether the panel is disabled. */
|
---|
65 | isDisabled() {
|
---|
66 | return __awaiter(this, void 0, void 0, function* () {
|
---|
67 | return (yield (yield this._header()).getAttribute('aria-disabled')) === 'true';
|
---|
68 | });
|
---|
69 | }
|
---|
70 | /**
|
---|
71 | * Toggles the expanded state of the panel by clicking on the panel
|
---|
72 | * header. This method will not work if the panel is disabled.
|
---|
73 | */
|
---|
74 | toggle() {
|
---|
75 | return __awaiter(this, void 0, void 0, function* () {
|
---|
76 | yield (yield this._header()).click();
|
---|
77 | });
|
---|
78 | }
|
---|
79 | /** Expands the expansion panel if collapsed. */
|
---|
80 | expand() {
|
---|
81 | return __awaiter(this, void 0, void 0, function* () {
|
---|
82 | if (!(yield this.isExpanded())) {
|
---|
83 | yield this.toggle();
|
---|
84 | }
|
---|
85 | });
|
---|
86 | }
|
---|
87 | /** Collapses the expansion panel if expanded. */
|
---|
88 | collapse() {
|
---|
89 | return __awaiter(this, void 0, void 0, function* () {
|
---|
90 | if (yield this.isExpanded()) {
|
---|
91 | yield this.toggle();
|
---|
92 | }
|
---|
93 | });
|
---|
94 | }
|
---|
95 | /** Gets the text content of the panel. */
|
---|
96 | getTextContent() {
|
---|
97 | return __awaiter(this, void 0, void 0, function* () {
|
---|
98 | return (yield this._content()).text();
|
---|
99 | });
|
---|
100 | }
|
---|
101 | /**
|
---|
102 | * Gets a `HarnessLoader` that can be used to load harnesses for
|
---|
103 | * components within the panel's content area.
|
---|
104 | * @deprecated Use either `getChildLoader(MatExpansionPanelSection.CONTENT)`, `getHarness` or
|
---|
105 | * `getAllHarnesses` instead.
|
---|
106 | * @breaking-change 12.0.0
|
---|
107 | */
|
---|
108 | getHarnessLoaderForContent() {
|
---|
109 | return __awaiter(this, void 0, void 0, function* () {
|
---|
110 | return this.getChildLoader(".mat-expansion-panel-content" /* CONTENT */);
|
---|
111 | });
|
---|
112 | }
|
---|
113 | /** Focuses the panel. */
|
---|
114 | focus() {
|
---|
115 | return __awaiter(this, void 0, void 0, function* () {
|
---|
116 | return (yield this._header()).focus();
|
---|
117 | });
|
---|
118 | }
|
---|
119 | /** Blurs the panel. */
|
---|
120 | blur() {
|
---|
121 | return __awaiter(this, void 0, void 0, function* () {
|
---|
122 | return (yield this._header()).blur();
|
---|
123 | });
|
---|
124 | }
|
---|
125 | /** Whether the panel is focused. */
|
---|
126 | isFocused() {
|
---|
127 | return __awaiter(this, void 0, void 0, function* () {
|
---|
128 | return (yield this._header()).isFocused();
|
---|
129 | });
|
---|
130 | }
|
---|
131 | /** Whether the panel has a toggle indicator displayed. */
|
---|
132 | hasToggleIndicator() {
|
---|
133 | return __awaiter(this, void 0, void 0, function* () {
|
---|
134 | return (yield this._expansionIndicator()) !== null;
|
---|
135 | });
|
---|
136 | }
|
---|
137 | /** Gets the position of the toggle indicator. */
|
---|
138 | getToggleIndicatorPosition() {
|
---|
139 | return __awaiter(this, void 0, void 0, function* () {
|
---|
140 | // By default the expansion indicator will show "after" the panel header content.
|
---|
141 | if (yield (yield this._header()).hasClass('mat-expansion-toggle-indicator-before')) {
|
---|
142 | return 'before';
|
---|
143 | }
|
---|
144 | return 'after';
|
---|
145 | });
|
---|
146 | }
|
---|
147 | }
|
---|
148 | MatExpansionPanelHarness.hostSelector = '.mat-expansion-panel';
|
---|
149 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhwYW5zaW9uLWhhcm5lc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwvZXhwYW5zaW9uL3Rlc3RpbmcvZXhwYW5zaW9uLWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOztBQUVILE9BQU8sRUFDTCxnQ0FBZ0MsRUFFaEMsZ0JBQWdCLEdBQ2pCLE1BQU0sc0JBQXNCLENBQUM7QUFXOUIsNEVBQTRFO0FBQzVFLE1BQU0sT0FBTyx3QkFBeUIsU0FDcEMsZ0NBQTBEO0lBRDVEOztRQUlVLFlBQU8sR0FBRyxJQUFJLENBQUMsVUFBVSw0Q0FBaUMsQ0FBQztRQUMzRCxXQUFNLEdBQUcsSUFBSSxDQUFDLGtCQUFrQixpREFBZ0MsQ0FBQztRQUNqRSxpQkFBWSxHQUFHLElBQUksQ0FBQyxrQkFBa0IsNkRBQXNDLENBQUM7UUFDN0Usd0JBQW1CLEdBQUcsSUFBSSxDQUFDLGtCQUFrQixDQUFDLDBCQUEwQixDQUFDLENBQUM7UUFDMUUsYUFBUSxHQUFHLElBQUksQ0FBQyxVQUFVLDhDQUFrQyxDQUFDO0lBK0h2RSxDQUFDO0lBN0hDOzs7Ozs7Ozs7T0FTRztJQUNILE1BQ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