source: trip-planner-front/node_modules/@angular/material/esm2015/tabs/testing/tab-link-harness.js@ ceaed42

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

initial commit

  • Property mode set to 100644
File size: 5.7 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';
10/** Harness for interacting with a standard Angular Material tab link in tests. */
11export class MatTabLinkHarness extends ComponentHarness {
12 /**
13 * Gets a `HarnessPredicate` that can be used to search for a `MatTabLinkHarness` that meets
14 * certain criteria.
15 * @param options Options for filtering which tab link instances are considered a match.
16 * @return a `HarnessPredicate` configured with the given options.
17 */
18 static with(options = {}) {
19 return new HarnessPredicate(MatTabLinkHarness, options)
20 .addOption('label', options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label));
21 }
22 /** Gets the label of the link. */
23 getLabel() {
24 return __awaiter(this, void 0, void 0, function* () {
25 return (yield this.host()).text();
26 });
27 }
28 /** Whether the link is active. */
29 isActive() {
30 return __awaiter(this, void 0, void 0, function* () {
31 const host = yield this.host();
32 return host.hasClass('mat-tab-label-active');
33 });
34 }
35 /** Whether the link is disabled. */
36 isDisabled() {
37 return __awaiter(this, void 0, void 0, function* () {
38 const host = yield this.host();
39 return host.hasClass('mat-tab-disabled');
40 });
41 }
42 /** Clicks on the link. */
43 click() {
44 return __awaiter(this, void 0, void 0, function* () {
45 yield (yield this.host()).click();
46 });
47 }
48}
49/** The selector for the host element of a `MatTabLink` instance. */
50MatTabLinkHarness.hostSelector = '.mat-tab-link';
51//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFiLWxpbmstaGFybmVzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4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