source: trip-planner-front/node_modules/@angular/material/fesm2015/card/testing.js@ 8d391a1

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

initial commit

  • Property mode set to 100644
File size: 3.0 KB
Line 
1import { __awaiter } from 'tslib';
2import { ContentContainerComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
3
4/**
5 * @license
6 * Copyright Google LLC All Rights Reserved.
7 *
8 * Use of this source code is governed by an MIT-style license that can be
9 * found in the LICENSE file at https://angular.io/license
10 */
11/** Harness for interacting with a standard mat-card in tests. */
12class MatCardHarness extends ContentContainerComponentHarness {
13 constructor() {
14 super(...arguments);
15 this._title = this.locatorForOptional('.mat-card-title');
16 this._subtitle = this.locatorForOptional('.mat-card-subtitle');
17 }
18 /**
19 * Gets a `HarnessPredicate` that can be used to search for a `MatCardHarness` that meets
20 * certain criteria.
21 * @param options Options for filtering which card instances are considered a match.
22 * @return a `HarnessPredicate` configured with the given options.
23 */
24 static with(options = {}) {
25 return new HarnessPredicate(MatCardHarness, options)
26 .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))
27 .addOption('title', options.title, (harness, title) => HarnessPredicate.stringMatches(harness.getTitleText(), title))
28 .addOption('subtitle', options.subtitle, (harness, subtitle) => HarnessPredicate.stringMatches(harness.getSubtitleText(), subtitle));
29 }
30 /** Gets all of the card's content as text. */
31 getText() {
32 return __awaiter(this, void 0, void 0, function* () {
33 return (yield this.host()).text();
34 });
35 }
36 /** Gets the cards's title text. */
37 getTitleText() {
38 var _a, _b;
39 return __awaiter(this, void 0, void 0, function* () {
40 return (_b = (_a = (yield this._title())) === null || _a === void 0 ? void 0 : _a.text()) !== null && _b !== void 0 ? _b : '';
41 });
42 }
43 /** Gets the cards's subtitle text. */
44 getSubtitleText() {
45 var _a, _b;
46 return __awaiter(this, void 0, void 0, function* () {
47 return (_b = (_a = (yield this._subtitle())) === null || _a === void 0 ? void 0 : _a.text()) !== null && _b !== void 0 ? _b : '';
48 });
49 }
50}
51/** The selector for the host element of a `MatCard` instance. */
52MatCardHarness.hostSelector = '.mat-card';
53
54/**
55 * @license
56 * Copyright Google LLC All Rights Reserved.
57 *
58 * Use of this source code is governed by an MIT-style license that can be
59 * found in the LICENSE file at https://angular.io/license
60 */
61
62/**
63 * @license
64 * Copyright Google LLC All Rights Reserved.
65 *
66 * Use of this source code is governed by an MIT-style license that can be
67 * found in the LICENSE file at https://angular.io/license
68 */
69
70/**
71 * @license
72 * Copyright Google LLC All Rights Reserved.
73 *
74 * Use of this source code is governed by an MIT-style license that can be
75 * found in the LICENSE file at https://angular.io/license
76 */
77
78export { MatCardHarness };
79//# sourceMappingURL=testing.js.map
Note: See TracBrowser for help on using the repository browser.