/** * @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 { MatListHarnessBase } from './list-harness-base'; import { getListItemPredicate, MatListItemHarnessBase } from './list-item-harness-base'; /** Harness for interacting with a MDC-based action-list in tests. */ export class MatActionListHarness extends MatListHarnessBase { constructor() { super(...arguments); this._itemHarness = MatActionListItemHarness; } /** The selector for the host element of a `MatActionList` instance. */ static { this.hostSelector = '.mat-mdc-action-list'; } /** * Gets a `HarnessPredicate` that can be used to search for an action list with specific * attributes. * @param options Options for filtering which action list instances are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(options = {}) { return new HarnessPredicate(this, options); } } /** Harness for interacting with an action list item. */ export class MatActionListItemHarness extends MatListItemHarnessBase { /** The selector for the host element of a `MatListItem` instance. */ static { this.hostSelector = `${MatActionListHarness.hostSelector} .mat-mdc-list-item`; } /** * Gets a `HarnessPredicate` that can be used to search for a list item with specific * attributes. * @param options Options for filtering which action list item instances are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(options = {}) { return getListItemPredicate(this, options); } /** Clicks on the action list item. */ async click() { return (await this.host()).click(); } /** Focuses the action list item. */ async focus() { return (await this.host()).focus(); } /** Blurs the action list item. */ async blur() { return (await this.host()).blur(); } /** Whether the action list item is focused. */ async isFocused() { return (await this.host()).isFocused(); } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWN0aW9uLWxpc3QtaGFybmVzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC9saXN0L3Rlc3RpbmcvYWN0aW9uLWxpc3QtaGFybmVzcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxPQUFPLEVBQThCLGdCQUFnQixFQUFDLE1BQU0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