source: trip-planner-front/node_modules/@angular/material/esm2015/button-toggle/testing/button-toggle-group-harness.js@ 84d0fbb

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

initial commit

  • Property mode set to 100644
File size: 6.9 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 { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
10import { MatButtonToggleHarness } from './button-toggle-harness';
11/** Harness for interacting with a standard mat-button-toggle in tests. */
12export class MatButtonToggleGroupHarness extends ComponentHarness {
13 /**
14 * Gets a `HarnessPredicate` that can be used to search for a `MatButtonToggleGroupHarness`
15 * that meets certain criteria.
16 * @param options Options for filtering which button toggle instances are considered a match.
17 * @return a `HarnessPredicate` configured with the given options.
18 */
19 static with(options = {}) {
20 return new HarnessPredicate(MatButtonToggleGroupHarness, options);
21 }
22 /**
23 * Gets the button toggles that are inside the group.
24 * @param filter Optionally filters which toggles are included.
25 */
26 getToggles(filter = {}) {
27 return __awaiter(this, void 0, void 0, function* () {
28 return this.locatorForAll(MatButtonToggleHarness.with(filter))();
29 });
30 }
31 /** Gets whether the button toggle group is disabled. */
32 isDisabled() {
33 return __awaiter(this, void 0, void 0, function* () {
34 return (yield (yield this.host()).getAttribute('aria-disabled')) === 'true';
35 });
36 }
37 /** Gets whether the button toggle group is laid out vertically. */
38 isVertical() {
39 return __awaiter(this, void 0, void 0, function* () {
40 return (yield this.host()).hasClass('mat-button-toggle-vertical');
41 });
42 }
43 /** Gets the appearance that the group is using. */
44 getAppearance() {
45 return __awaiter(this, void 0, void 0, function* () {
46 const host = yield this.host();
47 const className = 'mat-button-toggle-group-appearance-standard';
48 return (yield host.hasClass(className)) ? 'standard' : 'legacy';
49 });
50 }
51}
52/** The selector for the host element of a `MatButton` instance. */
53MatButtonToggleGroupHarness.hostSelector = '.mat-button-togg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