| 15 | |
| 16 | /** Harness for interacting with a Angular Material tab link in tests. */ |
| 17 | export class MatTabLinkHarness extends ComponentHarness { |
| 18 | /** The selector for the host element of a `MatTabLink` instance. */ |
| 19 | static hostSelector = '.mat-mdc-tab-link'; |
| 20 | |
| 21 | /** |
| 22 | * Gets a `HarnessPredicate` that can be used to search for a tab link with specific attributes. |
| 23 | * @param options Options for filtering which tab link instances are considered a match. |
| 24 | * @return a `HarnessPredicate` configured with the given options. |
| 25 | */ |
| 26 | static with<T extends MatTabLinkHarness>( |
| 27 | this: ComponentHarnessConstructor<T>, |
| 28 | options: TabLinkHarnessFilters = {}, |
| 29 | ): HarnessPredicate<T> { |
| 30 | return new HarnessPredicate(this, options).addOption('label', options.label, (harness, label) => |
| 31 | HarnessPredicate.stringMatches(harness.getLabel(), label), |
| 32 | ); |
| 33 | } |
| 34 | |
| 35 | /** Gets the label of the link. */ |
| 36 | async getLabel(): Promise<string> { |
| 37 | return (await this.host()).text(); |
| 38 | } |
| 39 | |
| 40 | /** Whether the link is active. */ |
| 41 | async isActive(): Promise<boolean> { |
| 42 | const host = await this.host(); |
| 43 | return host.hasClass('mdc-tab--active'); |
| 44 | } |
| 45 | |
| 46 | /** Whether the link is disabled. */ |
| 47 | async isDisabled(): Promise<boolean> { |
| 48 | const host = await this.host(); |
| 49 | return host.hasClass('mat-mdc-tab-disabled'); |
| 50 | } |
| 51 | |
| 52 | /** Clicks on the link. */ |
| 53 | async click(): Promise<void> { |
| 54 | await (await this.host()).click(); |
| 55 | } |
| 56 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…