/** * @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 { ComponentHarness, HarnessPredicate, ContentContainerComponentHarness, parallel, } from '@angular/cdk/testing'; const iconSelector = '.mat-list-icon'; const avatarSelector = '.mat-list-avatar'; /** * Gets a `HarnessPredicate` that applies the given `BaseListItemHarnessFilters` to the given * list item harness. * @template H The type of list item harness to create a predicate for. * @param harnessType A constructor for a list item harness. * @param options An instance of `BaseListItemHarnessFilters` to apply. * @return A `HarnessPredicate` for the given harness type with the given options applied. * @deprecated Use `getListItemPredicate` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. * @breaking-change 17.0.0 */ export function getListItemPredicate(harnessType, options) { return new HarnessPredicate(harnessType, options).addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text)); } /** * Harness for interacting with a list subheader. * @deprecated Use `MatSubheaderHarness` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. * @breaking-change 17.0.0 */ export class MatLegacySubheaderHarness extends ComponentHarness { static { this.hostSelector = '.mat-subheader'; } static with(options = {}) { return new HarnessPredicate(MatLegacySubheaderHarness, options).addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text)); } /** Gets the full text content of the list item (including text from any font icons). */ async getText() { return (await this.host()).text(); } } /** * Shared behavior among the harnesses for the various `MatListItem` flavors. * @docs-private * @deprecated Use `class` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. * @breaking-change 17.0.0 */ export class MatLegacyListItemHarnessBase extends ContentContainerComponentHarness { constructor() { super(...arguments); this._lines = this.locatorForAll('.mat-line'); this._avatar = this.locatorForOptional(avatarSelector); this._icon = this.locatorForOptional(iconSelector); } /** Gets the full text content of the list item. */ async getText() { return (await this.host()).text({ exclude: `${iconSelector}, ${avatarSelector}` }); } /** Gets the lines of text (`mat-line` elements) in this nav list item. */ async getLinesText() { const lines = await this._lines(); return parallel(() => lines.map(l => l.text())); } /** Whether this list item has an avatar. */ async hasAvatar() { return !!(await this._avatar()); } /** Whether this list item has an icon. */ async hasIcon() { return !!(await this._icon()); } /** Whether this list option is disabled. */ async isDisabled() { return (await this.host()).hasClass('mat-list-item-disabled'); } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlzdC1pdGVtLWhhcm5lc3MtYmFzZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC9sZWdhY3ktbGlzdC90ZXN0aW5nL2xpc3QtaXRlbS1oYXJuZXNzLWJhc2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUNMLGdCQUFnQixFQUVoQixnQkFBZ0IsRUFDaEIsZ0NBQWdDLEVBQ2hDLFFBQVEsR0FDVCxNQUFNLHNCQUFzQixDQUFDO0FBTTlCLE1BQU0sWUFBWSxHQUFHLGdCQUFnQixDQUFDO0FBQ3RDLE1BQU0sY0FBYyxHQUFHLGtCQUFrQixDQUFDO0FBRTFDOzs7Ozs7Ozs7R0FTRztBQUNILE1BQU0sVUFBVSxvQkFBb0IsQ0FDbEMsV0FBMkMsRUFDM0MsT0FBeUM7SUFFekMsT0FBTyxJQUFJLGdCQUFnQixDQUFDLFdBQVcsRUFBRSxPQUFPLENBQUMsQ0FBQyxTQUFTLENBQ3pELE1BQU0sRUFDTixPQUFPLENBQUMsSUFBSSxFQUNaLENBQUMsT0FBTyxFQUFFLElBQUksRUFBRSxFQUFFLENBQUMsZ0JBQWdCLENBQUMsYUFBYSxDQUFDLE9BQU8sQ0FBQyxPQUFPLEVBQUUsRUFBRSxJQUFJLENBQUMsQ0FDM0UsQ0FBQztBQUNKLENBQUM7QUFFRDs7OztHQUlHO0FBQ0gsTUFBTSxPQUFPLHlCQUEwQixT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