source: trip-planner-front/node_modules/@angular/material/fesm2015/button/testing.js@ 6c1585f

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

initial commit

  • Property mode set to 100644
File size: 3.1 KB
Line 
1import { __awaiter } from 'tslib';
2import { ContentContainerComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
3import { coerceBooleanProperty } from '@angular/cdk/coercion';
4
5/**
6 * @license
7 * Copyright Google LLC All Rights Reserved.
8 *
9 * Use of this source code is governed by an MIT-style license that can be
10 * found in the LICENSE file at https://angular.io/license
11 */
12/** Harness for interacting with a standard mat-button in tests. */
13class MatButtonHarness extends ContentContainerComponentHarness {
14 /**
15 * Gets a `HarnessPredicate` that can be used to search for a `MatButtonHarness` that meets
16 * certain criteria.
17 * @param options Options for filtering which button instances are considered a match.
18 * @return a `HarnessPredicate` configured with the given options.
19 */
20 static with(options = {}) {
21 return new HarnessPredicate(MatButtonHarness, options)
22 .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));
23 }
24 click(...args) {
25 return __awaiter(this, void 0, void 0, function* () {
26 return (yield this.host()).click(...args);
27 });
28 }
29 /** Whether the button is disabled. */
30 isDisabled() {
31 return __awaiter(this, void 0, void 0, function* () {
32 const disabled = (yield this.host()).getAttribute('disabled');
33 return coerceBooleanProperty(yield disabled);
34 });
35 }
36 /** Gets the button's label text. */
37 getText() {
38 return __awaiter(this, void 0, void 0, function* () {
39 return (yield this.host()).text();
40 });
41 }
42 /** Focuses the button. */
43 focus() {
44 return __awaiter(this, void 0, void 0, function* () {
45 return (yield this.host()).focus();
46 });
47 }
48 /** Blurs the button. */
49 blur() {
50 return __awaiter(this, void 0, void 0, function* () {
51 return (yield this.host()).blur();
52 });
53 }
54 /** Whether the button is focused. */
55 isFocused() {
56 return __awaiter(this, void 0, void 0, function* () {
57 return (yield this.host()).isFocused();
58 });
59 }
60}
61// TODO(jelbourn) use a single class, like `.mat-button-base`
62/** The selector for the host element of a `MatButton` instance. */
63MatButtonHarness.hostSelector = `[mat-button], [mat-raised-button], [mat-flat-button], [mat-icon-button],
64 [mat-stroked-button], [mat-fab], [mat-mini-fab]`;
65
66/**
67 * @license
68 * Copyright Google LLC All Rights Reserved.
69 *
70 * Use of this source code is governed by an MIT-style license that can be
71 * found in the LICENSE file at https://angular.io/license
72 */
73
74/**
75 * @license
76 * Copyright Google LLC All Rights Reserved.
77 *
78 * Use of this source code is governed by an MIT-style license that can be
79 * found in the LICENSE file at https://angular.io/license
80 */
81
82/**
83 * @license
84 * Copyright Google LLC All Rights Reserved.
85 *
86 * Use of this source code is governed by an MIT-style license that can be
87 * found in the LICENSE file at https://angular.io/license
88 */
89
90export { MatButtonHarness };
91//# sourceMappingURL=testing.js.map
Note: See TracBrowser for help on using the repository browser.