* Gets a `HarnessPredicate` that can be used to search for a tab with specific attributes. * @param options Options for filtering which tab instances are considered a match. * @return a `HarnessPredicate` configured with the given options.
(
this: ComponentHarnessConstructor<T>,
options: TabHarnessFilters = {},
)
| 25 | * @return a `HarnessPredicate` configured with the given options. |
| 26 | */ |
| 27 | static with<T extends MatTabHarness>( |
| 28 | this: ComponentHarnessConstructor<T>, |
| 29 | options: TabHarnessFilters = {}, |
| 30 | ): HarnessPredicate<T> { |
| 31 | return new HarnessPredicate(this, options) |
| 32 | .addOption('label', options.label, (harness, label) => |
| 33 | HarnessPredicate.stringMatches(harness.getLabel(), label), |
| 34 | ) |
| 35 | .addOption( |
| 36 | 'selected', |
| 37 | options.selected, |
| 38 | async (harness, selected) => (await harness.isSelected()) == selected, |
| 39 | ); |
| 40 | } |
| 41 | |
| 42 | /** Gets the label of the tab. */ |
| 43 | async getLabel(): Promise<string> { |
no test coverage detected