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 { HarnessPredicate } from '@angular/cdk/testing';
|
---|
10 | import { MatDrawerHarnessBase } from './drawer-harness';
|
---|
11 | /** Harness for interacting with a standard mat-sidenav in tests. */
|
---|
12 | export class MatSidenavHarness extends MatDrawerHarnessBase {
|
---|
13 | /**
|
---|
14 | * Gets a `HarnessPredicate` that can be used to search for a `MatSidenavHarness` that meets
|
---|
15 | * certain criteria.
|
---|
16 | * @param options Options for filtering which sidenav instances are considered a match.
|
---|
17 | * @return a `HarnessPredicate` configured with the given options.
|
---|
18 | */
|
---|
19 | static with(options = {}) {
|
---|
20 | return new HarnessPredicate(MatSidenavHarness, options)
|
---|
21 | .addOption('position', options.position, (harness, position) => __awaiter(this, void 0, void 0, function* () { return (yield harness.getPosition()) === position; }));
|
---|
22 | }
|
---|
23 | /** Whether the sidenav is fixed in the viewport. */
|
---|
24 | isFixedInViewport() {
|
---|
25 | return __awaiter(this, void 0, void 0, function* () {
|
---|
26 | return (yield this.host()).hasClass('mat-sidenav-fixed');
|
---|
27 | });
|
---|
28 | }
|
---|
29 | }
|
---|
30 | /** The selector for the host element of a `MatSidenav` instance. */
|
---|
31 | MatSidenavHarness.hostSelector = '.mat-sidenav';
|
---|
32 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2lkZW5hdi1oYXJuZXNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL3NpZGVuYXYvdGVzdGluZy9zaWRlbmF2LWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOztBQUV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