* Gets a `HarnessPredicate` that can be used to search for an option with specific attributes. * @param options Options for filtering which option instances are considered a match. * @return a `HarnessPredicate` configured with the given options.
(
this: ComponentHarnessConstructor<T>,
options: OptionHarnessFilters = {},
)
| 27 | * @return a `HarnessPredicate` configured with the given options. |
| 28 | */ |
| 29 | static with<T extends MatOptionHarness>( |
| 30 | this: ComponentHarnessConstructor<T>, |
| 31 | options: OptionHarnessFilters = {}, |
| 32 | ): HarnessPredicate<T> { |
| 33 | return new HarnessPredicate(this, options) |
| 34 | .addOption('text', options.text, async (harness, title) => |
| 35 | HarnessPredicate.stringMatches(await harness.getText(), title), |
| 36 | ) |
| 37 | .addOption( |
| 38 | 'isSelected', |
| 39 | options.isSelected, |
| 40 | async (harness, isSelected) => (await harness.isSelected()) === isSelected, |
| 41 | ); |
| 42 | } |
| 43 | |
| 44 | /** Clicks the option. */ |
| 45 | async click(): Promise<void> { |
no test coverage detected