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, TestKey } from '@angular/cdk/testing';
|
---|
10 | /** Harness for interacting with a standard MatBottomSheet in tests. */
|
---|
11 | export class MatBottomSheetHarness extends ContentContainerComponentHarness {
|
---|
12 | /**
|
---|
13 | * Gets a `HarnessPredicate` that can be used to search for a bottom sheet with
|
---|
14 | * specific attributes.
|
---|
15 | * @param options Options for narrowing the search.
|
---|
16 | * @return a `HarnessPredicate` configured with the given options.
|
---|
17 | */
|
---|
18 | static with(options = {}) {
|
---|
19 | return new HarnessPredicate(MatBottomSheetHarness, options);
|
---|
20 | }
|
---|
21 | /** Gets the value of the bottom sheet's "aria-label" attribute. */
|
---|
22 | getAriaLabel() {
|
---|
23 | return __awaiter(this, void 0, void 0, function* () {
|
---|
24 | return (yield this.host()).getAttribute('aria-label');
|
---|
25 | });
|
---|
26 | }
|
---|
27 | /**
|
---|
28 | * Dismisses the bottom sheet by pressing escape. Note that this method cannot
|
---|
29 | * be used if "disableClose" has been set to true via the config.
|
---|
30 | */
|
---|
31 | dismiss() {
|
---|
32 | return __awaiter(this, void 0, void 0, function* () {
|
---|
33 | yield (yield this.host()).sendKeys(TestKey.ESCAPE);
|
---|
34 | });
|
---|
35 | }
|
---|
36 | }
|
---|
37 | // Developers can provide a custom component or template for the
|
---|
38 | // bottom sheet. The canonical parent is the ".mat-bottom-sheet-container".
|
---|
39 | MatBottomSheetHarness.hostSelector = '.mat-bottom-sheet-container';
|
---|
40 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYm90dG9tLXNoZWV0LWhhcm5lc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8u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