UNPKG

1.9 kBJavaScriptView Raw
1import { __awaiter } from 'tslib';
2import { ContentContainerComponentHarness, HarnessPredicate, TestKey } from '@angular/cdk/testing';
3
4/** Harness for interacting with a standard MatBottomSheet in tests. */
5class MatBottomSheetHarness extends ContentContainerComponentHarness {
6 /**
7 * Gets a `HarnessPredicate` that can be used to search for a bottom sheet with
8 * specific attributes.
9 * @param options Options for narrowing the search.
10 * @return a `HarnessPredicate` configured with the given options.
11 */
12 static with(options = {}) {
13 return new HarnessPredicate(MatBottomSheetHarness, options);
14 }
15 /** Gets the value of the bottom sheet's "aria-label" attribute. */
16 getAriaLabel() {
17 return __awaiter(this, void 0, void 0, function* () {
18 return (yield this.host()).getAttribute('aria-label');
19 });
20 }
21 /**
22 * Dismisses the bottom sheet by pressing escape. Note that this method cannot
23 * be used if "disableClose" has been set to true via the config.
24 */
25 dismiss() {
26 return __awaiter(this, void 0, void 0, function* () {
27 yield (yield this.host()).sendKeys(TestKey.ESCAPE);
28 });
29 }
30}
31// Developers can provide a custom component or template for the
32// bottom sheet. The canonical parent is the ".mat-bottom-sheet-container".
33MatBottomSheetHarness.hostSelector = '.mat-bottom-sheet-container';
34
35/**
36 * @license
37 * Copyright Google LLC All Rights Reserved.
38 *
39 * Use of this source code is governed by an MIT-style license that can be
40 * found in the LICENSE file at https://angular.io/license
41 */
42
43/**
44 * @license
45 * Copyright Google LLC All Rights Reserved.
46 *
47 * Use of this source code is governed by an MIT-style license that can be
48 * found in the LICENSE file at https://angular.io/license
49 */
50
51export { MatBottomSheetHarness };
52//# sourceMappingURL=testing.mjs.map