/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { HarnessPredicate } from '@angular/cdk/testing'; import { MatDrawerHarnessBase } from './drawer-harness'; /** Harness for interacting with a standard mat-sidenav in tests. */ export class MatSidenavHarness extends MatDrawerHarnessBase { /** The selector for the host element of a `MatSidenav` instance. */ static { this.hostSelector = '.mat-sidenav'; } /** * Gets a `HarnessPredicate` that can be used to search for a `MatSidenavHarness` that meets * certain criteria. * @param options Options for filtering which sidenav instances are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(options = {}) { return new HarnessPredicate(MatSidenavHarness, options).addOption('position', options.position, async (harness, position) => (await harness.getPosition()) === position); } /** Whether the sidenav is fixed in the viewport. */ async isFixedInViewport() { return (await this.host()).hasClass('mat-sidenav-fixed'); } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2lkZW5hdi1oYXJuZXNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL3NpZGVuYXYvdGVzdGluZy9zaWRlbmF2LWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLGdCQUFnQixFQUFDLE1BQU0sc0JBQXNCLENBQUM7QUFDdEQsT0FBTyxFQUFDLG9CQUFvQixFQUFDLE1BQU0sa0JBQWtCLENBQUM7QUFHdEQsb0VBQW9FO0FBQ3BFLE1BQU0sT0FBTyxpQkFBa0IsU0FBUSxvQkFBb0I7SUFDekQsb0VBQW9FO2FBQzdELGlCQUFZLEdBQUcsY0FBYyxDQUFDO0lBRXJDOzs7OztPQUtHO0lBQ0gsTUFBTSxDQUFDLElBQUksQ0FBQyxVQUFnQyxFQUFFO1FBQzVDLE9BQU8sSUFBSSxnQkFBZ0IsQ0FBQyxpQkFB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