source: trip-planner-front/node_modules/@angular/material/esm2015/list/testing/action-list-harness.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 7.8 KB
Line 
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 */
8import { __awaiter } from "tslib";
9import { HarnessPredicate } from '@angular/cdk/testing';
10import { MatListHarnessBase } from './list-harness-base';
11import { getListItemPredicate, MatListItemHarnessBase } from './list-item-harness-base';
12/** Harness for interacting with a standard mat-action-list in tests. */
13export class MatActionListHarness extends MatListHarnessBase {
14 constructor() {
15 super(...arguments);
16 this._itemHarness = MatActionListItemHarness;
17 }
18 /**
19 * Gets a `HarnessPredicate` that can be used to search for a `MatActionListHarness` that meets
20 * certain criteria.
21 * @param options Options for filtering which action list instances are considered a match.
22 * @return a `HarnessPredicate` configured with the given options.
23 */
24 static with(options = {}) {
25 return new HarnessPredicate(MatActionListHarness, options);
26 }
27}
28/** The selector for the host element of a `MatActionList` instance. */
29MatActionListHarness.hostSelector = 'mat-action-list.mat-list';
30/** Harness for interacting with an action list item. */
31export class MatActionListItemHarness extends MatListItemHarnessBase {
32 /**
33 * Gets a `HarnessPredicate` that can be used to search for a `MatActionListItemHarness` that
34 * meets certain criteria.
35 * @param options Options for filtering which action list item instances are considered a match.
36 * @return a `HarnessPredicate` configured with the given options.
37 */
38 static with(options = {}) {
39 return getListItemPredicate(MatActionListItemHarness, options);
40 }
41 /** Clicks on the action list item. */
42 click() {
43 return __awaiter(this, void 0, void 0, function* () {
44 return (yield this.host()).click();
45 });
46 }
47 /** Focuses the action list item. */
48 focus() {
49 return __awaiter(this, void 0, void 0, function* () {
50 return (yield this.host()).focus();
51 });
52 }
53 /** Blurs the action list item. */
54 blur() {
55 return __awaiter(this, void 0, void 0, function* () {
56 return (yield this.host()).blur();
57 });
58 }
59 /** Whether the action list item is focused. */
60 isFocused() {
61 return __awaiter(this, void 0, void 0, function* () {
62 return (yield this.host()).isFocused();
63 });
64 }
65}
66/** The selector for the host element of a `MatListItem` instance. */
67MatActionListItemHarness.hostSelector = `${MatActionListHarness.hostSelector} .mat-list-item`;
68//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWN0aW9uLWxpc3QtaGFybmVzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC9saXN0L3Rlc3RpbmcvYWN0aW9uLWxpc3QtaGFybmVzcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7O0FBRUgsT0FBTyxFQUFDLGdCQUFnQixFQUFDLE1BQU0sc0JBQXNCLENBQUM7QUFDdEQsT0FBTyxFQUFDLGtCQUFrQixFQUFDLE1BQU0scUJBQXFCLENBQUM7QUFFdkQsT0FBTyxFQUFDLG9CQUFvQixFQUFFLHNCQUFzQixFQUFDLE1BQU0sMEJBQTBCLENBQUM7QUFFdEYsd0VBQXdFO0FBQ3hFLE1BQU0sT0FBTyxvQkFBcUIsU0FBUSxrQkFDa0Q7SUFENUY7O1FBZVcsaUJBQVksR0FBRyx3QkFBd0IsQ0FBQztJQUNuRCxDQUFDO0lBWEM7Ozs7O09BS0c7SUFDSCxNQUFNLENBQUMsSUFBSSxDQUFDLFVBQW9DLEVBQUU7UUFDaEQsT0FBTyxJQUFJLGdCQUFnQixDQUFDLG9CQUFvQixFQUFFLE9BQU8sQ0FBQyxDQUFDO0lBQzdELENBQUM7O0FBWEQsdUVBQXVFO0FBQ2hFLGlDQUFZLEdBQUcsMEJBQTBCLENBQUM7QUFlbkQsd0RBQXdEO0FBQ3hELE1BQU0sT0FBTyx3QkFBeUIsU0FBUSxzQkFBc0I7SUFJbEU7Ozs7O09BS0c7SUFDSCxNQUFNLENBQUMsSUFBSSxDQUFDLFVB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