source: trip-planner-front/node_modules/@angular/material/esm2015/list/testing/selection-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: 17.1 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, parallel } 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-selection-list in tests. */
13export class MatSelectionListHarness extends MatListHarnessBase {
14 constructor() {
15 super(...arguments);
16 this._itemHarness = MatListOptionHarness;
17 }
18 /**
19 * Gets a `HarnessPredicate` that can be used to search for a `MatSelectionListHarness` that meets
20 * certain criteria.
21 * @param options Options for filtering which selection list instances are considered a match.
22 * @return a `HarnessPredicate` configured with the given options.
23 */
24 static with(options = {}) {
25 return new HarnessPredicate(MatSelectionListHarness, options);
26 }
27 /** Whether the selection list is disabled. */
28 isDisabled() {
29 return __awaiter(this, void 0, void 0, function* () {
30 return (yield (yield this.host()).getAttribute('aria-disabled')) === 'true';
31 });
32 }
33 /**
34 * Selects all items matching any of the given filters.
35 * @param filters Filters that specify which items should be selected.
36 */
37 selectItems(...filters) {
38 return __awaiter(this, void 0, void 0, function* () {
39 const items = yield this._getItems(filters);
40 yield parallel(() => items.map(item => item.select()));
41 });
42 }
43 /**
44 * Deselects all items matching any of the given filters.
45 * @param filters Filters that specify which items should be deselected.
46 */
47 deselectItems(...filters) {
48 return __awaiter(this, void 0, void 0, function* () {
49 const items = yield this._getItems(filters);
50 yield parallel(() => items.map(item => item.deselect()));
51 });
52 }
53 /** Gets all items matching the given list of filters. */
54 _getItems(filters) {
55 return __awaiter(this, void 0, void 0, function* () {
56 if (!filters.length) {
57 return this.getItems();
58 }
59 const matches = yield parallel(() => {
60 return filters.map(filter => this.locatorForAll(MatListOptionHarness.with(filter))());
61 });
62 return matches.reduce((result, current) => [...result, ...current], []);
63 });
64 }
65}
66/** The selector for the host element of a `MatSelectionList` instance. */
67MatSelectionListHarness.hostSelector = '.mat-selection-list';
68/** Harness for interacting with a list option. */
69export class MatListOptionHarness extends MatListItemHarnessBase {
70 constructor() {
71 super(...arguments);
72 this._itemContent = this.locatorFor('.mat-list-item-content');
73 }
74 /**
75 * Gets a `HarnessPredicate` that can be used to search for a `MatListOptionHarness` that
76 * meets certain criteria.
77 * @param options Options for filtering which list option instances are considered a match.
78 * @return a `HarnessPredicate` configured with the given options.
79 */
80 static with(options = {}) {
81 return getListItemPredicate(MatListOptionHarness, options)
82 .addOption('is selected', options.selected, (harness, selected) => __awaiter(this, void 0, void 0, function* () { return (yield harness.isSelected()) === selected; }));
83 }
84 /** Gets the position of the checkbox relative to the list option content. */
85 getCheckboxPosition() {
86 return __awaiter(this, void 0, void 0, function* () {
87 return (yield (yield this._itemContent()).hasClass('mat-list-item-content-reverse')) ?
88 'after' : 'before';
89 });
90 }
91 /** Whether the list option is selected. */
92 isSelected() {
93 return __awaiter(this, void 0, void 0, function* () {
94 return (yield (yield this.host()).getAttribute('aria-selected')) === 'true';
95 });
96 }
97 /** Whether the list option is disabled. */
98 isDisabled() {
99 return __awaiter(this, void 0, void 0, function* () {
100 return (yield (yield this.host()).getAttribute('aria-disabled')) === 'true';
101 });
102 }
103 /** Focuses the list option. */
104 focus() {
105 return __awaiter(this, void 0, void 0, function* () {
106 return (yield this.host()).focus();
107 });
108 }
109 /** Blurs the list option. */
110 blur() {
111 return __awaiter(this, void 0, void 0, function* () {
112 return (yield this.host()).blur();
113 });
114 }
115 /** Whether the list option is focused. */
116 isFocused() {
117 return __awaiter(this, void 0, void 0, function* () {
118 return (yield this.host()).isFocused();
119 });
120 }
121 /** Toggles the checked state of the checkbox. */
122 toggle() {
123 return __awaiter(this, void 0, void 0, function* () {
124 return (yield this.host()).click();
125 });
126 }
127 /**
128 * Puts the list option in a checked state by toggling it if it is currently unchecked, or doing
129 * nothing if it is already checked.
130 */
131 select() {
132 return __awaiter(this, void 0, void 0, function* () {
133 if (!(yield this.isSelected())) {
134 return this.toggle();
135 }
136 });
137 }
138 /**
139 * Puts the list option in an unchecked state by toggling it if it is currently checked, or doing
140 * nothing if it is already unchecked.
141 */
142 deselect() {
143 return __awaiter(this, void 0, void 0, function* () {
144 if (yield this.isSelected()) {
145 return this.toggle();
146 }
147 });
148 }
149}
150/** The selector for the host element of a `MatListOption` instance. */
151MatListOptionHarness.hostSelector = '.mat-list-option';
152//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VsZWN0aW9uLWxpc3QtaGFybmVzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC9saXN0L3Rlc3Rpbmcvc2VsZWN0aW9uLWxpc3QtaGFybmVzcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7O0FBRUgsT0FBTyxFQUFDLGdCQUFnQixFQUFFLFFBQVEsRUFBQyxNQUFNLHNCQUFzQixDQUFDO0FBRWhFLE9BQU8sRUFBQyxrQkFBa0IsRUFBQyxNQUFNLHFCQUFxQixDQUFDO0FBTXZELE9BQU8sRUFBQyxvQkFBb0IsRUFBRSxzQkFBc0IsRUFBQyxNQUFNLDBCQUEwQixDQUFDO0FBRXRGLDJFQUEyRTtBQUMzRSxNQUFNLE9BQU8sdUJBQXdCLFNBQVEsa0JBQ21DO0lBRGhGOztRQWdCVyxpQkFBWSxHQUFHLG9CQUFvQixDQUFDO0lBbUMvQyxDQUFDO0lBOUNDOzs7OztPQUtHO0lBQ0gsTUFBTSxDQUFDLElBQUksQ0FBQyxVQUF1QyxFQUFFO1FBRW5ELE9BQU8sSUFBSSxnQkFBZ0IsQ0FBQyx1QkFBdUIsRUFBRSxP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