source: trip-planner-front/node_modules/@angular/material/fesm2015/sidenav/testing.js@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 8.9 KB
Line 
1import { __awaiter } from 'tslib';
2import { ContentContainerComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
3
4/**
5 * @license
6 * Copyright Google LLC All Rights Reserved.
7 *
8 * Use of this source code is governed by an MIT-style license that can be
9 * found in the LICENSE file at https://angular.io/license
10 */
11/**
12 * Base class for the drawer harness functionality.
13 * @docs-private
14 */
15class MatDrawerHarnessBase extends ContentContainerComponentHarness {
16 /** Whether the drawer is open. */
17 isOpen() {
18 return __awaiter(this, void 0, void 0, function* () {
19 return (yield this.host()).hasClass('mat-drawer-opened');
20 });
21 }
22 /** Gets the position of the drawer inside its container. */
23 getPosition() {
24 return __awaiter(this, void 0, void 0, function* () {
25 const host = yield this.host();
26 return (yield host.hasClass('mat-drawer-end')) ? 'end' : 'start';
27 });
28 }
29 /** Gets the mode that the drawer is in. */
30 getMode() {
31 return __awaiter(this, void 0, void 0, function* () {
32 const host = yield this.host();
33 if (yield host.hasClass('mat-drawer-push')) {
34 return 'push';
35 }
36 if (yield host.hasClass('mat-drawer-side')) {
37 return 'side';
38 }
39 return 'over';
40 });
41 }
42}
43/** Harness for interacting with a standard mat-drawer in tests. */
44class MatDrawerHarness extends MatDrawerHarnessBase {
45 /**
46 * Gets a `HarnessPredicate` that can be used to search for a `MatDrawerHarness` that meets
47 * certain criteria.
48 * @param options Options for filtering which drawer instances are considered a match.
49 * @return a `HarnessPredicate` configured with the given options.
50 */
51 static with(options = {}) {
52 return new HarnessPredicate(MatDrawerHarness, options)
53 .addOption('position', options.position, (harness, position) => __awaiter(this, void 0, void 0, function* () { return (yield harness.getPosition()) === position; }));
54 }
55}
56/** The selector for the host element of a `MatDrawer` instance. */
57MatDrawerHarness.hostSelector = '.mat-drawer';
58
59/**
60 * @license
61 * Copyright Google LLC All Rights Reserved.
62 *
63 * Use of this source code is governed by an MIT-style license that can be
64 * found in the LICENSE file at https://angular.io/license
65 */
66/** Harness for interacting with a standard mat-drawer-content in tests. */
67class MatDrawerContentHarness extends ContentContainerComponentHarness {
68 /**
69 * Gets a `HarnessPredicate` that can be used to search for a `MatDrawerContentHarness` that
70 * meets certain criteria.
71 * @param options Options for filtering which drawer content instances are considered a match.
72 * @return a `HarnessPredicate` configured with the given options.
73 */
74 static with(options = {}) {
75 return new HarnessPredicate(MatDrawerContentHarness, options);
76 }
77}
78/** The selector for the host element of a `MatDrawerContent` instance. */
79MatDrawerContentHarness.hostSelector = '.mat-drawer-content';
80
81/**
82 * @license
83 * Copyright Google LLC All Rights Reserved.
84 *
85 * Use of this source code is governed by an MIT-style license that can be
86 * found in the LICENSE file at https://angular.io/license
87 */
88/** Harness for interacting with a standard mat-drawer-container in tests. */
89class MatDrawerContainerHarness extends ContentContainerComponentHarness {
90 /**
91 * Gets a `HarnessPredicate` that can be used to search for a `MatDrawerContainerHarness` that
92 * meets certain criteria.
93 * @param options Options for filtering which container instances are considered a match.
94 * @return a `HarnessPredicate` configured with the given options.
95 */
96 static with(options = {}) {
97 return new HarnessPredicate(MatDrawerContainerHarness, options);
98 }
99 /**
100 * Gets drawers that match particular criteria within the container.
101 * @param filter Optionally filters which chips are included.
102 */
103 getDrawers(filter = {}) {
104 return __awaiter(this, void 0, void 0, function* () {
105 return this.locatorForAll(MatDrawerHarness.with(filter))();
106 });
107 }
108 /** Gets the element that has the container's content. */
109 getContent() {
110 return __awaiter(this, void 0, void 0, function* () {
111 return this.locatorFor(MatDrawerContentHarness)();
112 });
113 }
114}
115/** The selector for the host element of a `MatDrawerContainer` instance. */
116MatDrawerContainerHarness.hostSelector = '.mat-drawer-container';
117
118/**
119 * @license
120 * Copyright Google LLC All Rights Reserved.
121 *
122 * Use of this source code is governed by an MIT-style license that can be
123 * found in the LICENSE file at https://angular.io/license
124 */
125
126/**
127 * @license
128 * Copyright Google LLC All Rights Reserved.
129 *
130 * Use of this source code is governed by an MIT-style license that can be
131 * found in the LICENSE file at https://angular.io/license
132 */
133/** Harness for interacting with a standard mat-sidenav-content in tests. */
134class MatSidenavContentHarness extends ContentContainerComponentHarness {
135 /**
136 * Gets a `HarnessPredicate` that can be used to search for a `MatSidenavContentHarness` that
137 * meets certain criteria.
138 * @param options Options for filtering which sidenav content instances are considered a match.
139 * @return a `HarnessPredicate` configured with the given options.
140 */
141 static with(options = {}) {
142 return new HarnessPredicate(MatSidenavContentHarness, options);
143 }
144}
145/** The selector for the host element of a `MatSidenavContent` instance. */
146MatSidenavContentHarness.hostSelector = '.mat-sidenav-content';
147
148/**
149 * @license
150 * Copyright Google LLC All Rights Reserved.
151 *
152 * Use of this source code is governed by an MIT-style license that can be
153 * found in the LICENSE file at https://angular.io/license
154 */
155/** Harness for interacting with a standard mat-sidenav in tests. */
156class MatSidenavHarness extends MatDrawerHarnessBase {
157 /**
158 * Gets a `HarnessPredicate` that can be used to search for a `MatSidenavHarness` that meets
159 * certain criteria.
160 * @param options Options for filtering which sidenav instances are considered a match.
161 * @return a `HarnessPredicate` configured with the given options.
162 */
163 static with(options = {}) {
164 return new HarnessPredicate(MatSidenavHarness, options)
165 .addOption('position', options.position, (harness, position) => __awaiter(this, void 0, void 0, function* () { return (yield harness.getPosition()) === position; }));
166 }
167 /** Whether the sidenav is fixed in the viewport. */
168 isFixedInViewport() {
169 return __awaiter(this, void 0, void 0, function* () {
170 return (yield this.host()).hasClass('mat-sidenav-fixed');
171 });
172 }
173}
174/** The selector for the host element of a `MatSidenav` instance. */
175MatSidenavHarness.hostSelector = '.mat-sidenav';
176
177/**
178 * @license
179 * Copyright Google LLC All Rights Reserved.
180 *
181 * Use of this source code is governed by an MIT-style license that can be
182 * found in the LICENSE file at https://angular.io/license
183 */
184/** Harness for interacting with a standard mat-sidenav-container in tests. */
185class MatSidenavContainerHarness extends ContentContainerComponentHarness {
186 /**
187 * Gets a `HarnessPredicate` that can be used to search for a `MatSidenavContainerHarness` that
188 * meets certain criteria.
189 * @param options Options for filtering which container instances are considered a match.
190 * @return a `HarnessPredicate` configured with the given options.
191 */
192 static with(options = {}) {
193 return new HarnessPredicate(MatSidenavContainerHarness, options);
194 }
195 /**
196 * Gets sidenavs that match particular criteria within the container.
197 * @param filter Optionally filters which chips are included.
198 */
199 getSidenavs(filter = {}) {
200 return __awaiter(this, void 0, void 0, function* () {
201 return this.locatorForAll(MatSidenavHarness.with(filter))();
202 });
203 }
204 /** Gets the element that has the container's content. */
205 getContent() {
206 return __awaiter(this, void 0, void 0, function* () {
207 return this.locatorFor(MatSidenavContentHarness)();
208 });
209 }
210}
211/** The selector for the host element of a `MatSidenavContainer` instance. */
212MatSidenavContainerHarness.hostSelector = '.mat-sidenav-container';
213
214/**
215 * @license
216 * Copyright Google LLC All Rights Reserved.
217 *
218 * Use of this source code is governed by an MIT-style license that can be
219 * found in the LICENSE file at https://angular.io/license
220 */
221
222/**
223 * @license
224 * Copyright Google LLC All Rights Reserved.
225 *
226 * Use of this source code is governed by an MIT-style license that can be
227 * found in the LICENSE file at https://angular.io/license
228 */
229
230export { MatDrawerContainerHarness, MatDrawerContentHarness, MatDrawerHarness, MatSidenavContainerHarness, MatSidenavContentHarness, MatSidenavHarness };
231//# sourceMappingURL=testing.js.map
Note: See TracBrowser for help on using the repository browser.