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 | */
|
---|
8 | import { __awaiter } from "tslib";
|
---|
9 | import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
|
---|
10 | import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
---|
11 | /** Harness for interacting with a standard mat-button-toggle in tests. */
|
---|
12 | export class MatButtonToggleHarness extends ComponentHarness {
|
---|
13 | constructor() {
|
---|
14 | super(...arguments);
|
---|
15 | this._label = this.locatorFor('.mat-button-toggle-label-content');
|
---|
16 | this._button = this.locatorFor('.mat-button-toggle-button');
|
---|
17 | }
|
---|
18 | /**
|
---|
19 | * Gets a `HarnessPredicate` that can be used to search for a `MatButtonToggleHarness` that meets
|
---|
20 | * certain criteria.
|
---|
21 | * @param options Options for filtering which button toggle instances are considered a match.
|
---|
22 | * @return a `HarnessPredicate` configured with the given options.
|
---|
23 | */
|
---|
24 | static with(options = {}) {
|
---|
25 | return new HarnessPredicate(MatButtonToggleHarness, options)
|
---|
26 | .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))
|
---|
27 | .addOption('name', options.name, (harness, name) => HarnessPredicate.stringMatches(harness.getName(), name))
|
---|
28 | .addOption('checked', options.checked, (harness, checked) => __awaiter(this, void 0, void 0, function* () { return (yield harness.isChecked()) === checked; }));
|
---|
29 | }
|
---|
30 | /** Gets a boolean promise indicating if the button toggle is checked. */
|
---|
31 | isChecked() {
|
---|
32 | return __awaiter(this, void 0, void 0, function* () {
|
---|
33 | const checked = (yield this._button()).getAttribute('aria-pressed');
|
---|
34 | return coerceBooleanProperty(yield checked);
|
---|
35 | });
|
---|
36 | }
|
---|
37 | /** Gets a boolean promise indicating if the button toggle is disabled. */
|
---|
38 | isDisabled() {
|
---|
39 | return __awaiter(this, void 0, void 0, function* () {
|
---|
40 | const disabled = (yield this._button()).getAttribute('disabled');
|
---|
41 | return coerceBooleanProperty(yield disabled);
|
---|
42 | });
|
---|
43 | }
|
---|
44 | /** Gets a promise for the button toggle's name. */
|
---|
45 | getName() {
|
---|
46 | return __awaiter(this, void 0, void 0, function* () {
|
---|
47 | return (yield this._button()).getAttribute('name');
|
---|
48 | });
|
---|
49 | }
|
---|
50 | /** Gets a promise for the button toggle's aria-label. */
|
---|
51 | getAriaLabel() {
|
---|
52 | return __awaiter(this, void 0, void 0, function* () {
|
---|
53 | return (yield this._button()).getAttribute('aria-label');
|
---|
54 | });
|
---|
55 | }
|
---|
56 | /** Gets a promise for the button toggles's aria-labelledby. */
|
---|
57 | getAriaLabelledby() {
|
---|
58 | return __awaiter(this, void 0, void 0, function* () {
|
---|
59 | return (yield this._button()).getAttribute('aria-labelledby');
|
---|
60 | });
|
---|
61 | }
|
---|
62 | /** Gets a promise for the button toggle's text. */
|
---|
63 | getText() {
|
---|
64 | return __awaiter(this, void 0, void 0, function* () {
|
---|
65 | return (yield this._label()).text();
|
---|
66 | });
|
---|
67 | }
|
---|
68 | /** Gets the appearance that the button toggle is using. */
|
---|
69 | getAppearance() {
|
---|
70 | return __awaiter(this, void 0, void 0, function* () {
|
---|
71 | const host = yield this.host();
|
---|
72 | const className = 'mat-button-toggle-appearance-standard';
|
---|
73 | return (yield host.hasClass(className)) ? 'standard' : 'legacy';
|
---|
74 | });
|
---|
75 | }
|
---|
76 | /** Focuses the toggle. */
|
---|
77 | focus() {
|
---|
78 | return __awaiter(this, void 0, void 0, function* () {
|
---|
79 | return (yield this._button()).focus();
|
---|
80 | });
|
---|
81 | }
|
---|
82 | /** Blurs the toggle. */
|
---|
83 | blur() {
|
---|
84 | return __awaiter(this, void 0, void 0, function* () {
|
---|
85 | return (yield this._button()).blur();
|
---|
86 | });
|
---|
87 | }
|
---|
88 | /** Whether the toggle is focused. */
|
---|
89 | isFocused() {
|
---|
90 | return __awaiter(this, void 0, void 0, function* () {
|
---|
91 | return (yield this._button()).isFocused();
|
---|
92 | });
|
---|
93 | }
|
---|
94 | /** Toggle the checked state of the buttons toggle. */
|
---|
95 | toggle() {
|
---|
96 | return __awaiter(this, void 0, void 0, function* () {
|
---|
97 | return (yield this._button()).click();
|
---|
98 | });
|
---|
99 | }
|
---|
100 | /**
|
---|
101 | * Puts the button toggle in a checked state by toggling it if it's
|
---|
102 | * currently unchecked, or doing nothing if it is already checked.
|
---|
103 | */
|
---|
104 | check() {
|
---|
105 | return __awaiter(this, void 0, void 0, function* () {
|
---|
106 | if (!(yield this.isChecked())) {
|
---|
107 | yield this.toggle();
|
---|
108 | }
|
---|
109 | });
|
---|
110 | }
|
---|
111 | /**
|
---|
112 | * Puts the button toggle in an unchecked state by toggling it if it's
|
---|
113 | * currently checked, or doing nothing if it's already unchecked.
|
---|
114 | */
|
---|
115 | uncheck() {
|
---|
116 | return __awaiter(this, void 0, void 0, function* () {
|
---|
117 | if (yield this.isChecked()) {
|
---|
118 | yield this.toggle();
|
---|
119 | }
|
---|
120 | });
|
---|
121 | }
|
---|
122 | }
|
---|
123 | /** The selector for the host element of a `MatButton` instance. */
|
---|
124 | MatButtonToggleHarness.hostSelector = '.mat-button-toggle';
|
---|
125 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnV0dG9uLXRvZ2dsZS1oYXJuZXNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL2J1dHRvbi10b2dnbGUvdGVzdGluZy9idXR0b24tdG9nZ2xlLWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOztBQUVILE9BQU8sRUFBQyxnQkFBZ0IsRUFBRSxnQkFBZ0IsRUFBQyxNQUFNLHNCQUFzQixDQUFDO0FBQ3hFLE9BQU8sRUFBQyxxQkFBcUIsRUFBQyxNQUFNLHV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