* Gets a `HarnessPredicate` that can be used to search for a menu with specific attributes. * @param options Options for filtering which menu instances are considered a match. * @return a `HarnessPredicate` configured with the given options.
(
this: ComponentHarnessConstructor<T>,
options: MenuHarnessFilters = {},
)
| 30 | * @return a `HarnessPredicate` configured with the given options. |
| 31 | */ |
| 32 | static with<T extends MatMenuHarness>( |
| 33 | this: ComponentHarnessConstructor<T>, |
| 34 | options: MenuHarnessFilters = {}, |
| 35 | ): HarnessPredicate<T> { |
| 36 | return new HarnessPredicate(this, options) |
| 37 | .addOption('triggerText', options.triggerText, (harness, text) => |
| 38 | HarnessPredicate.stringMatches(harness.getTriggerText(), text), |
| 39 | ) |
| 40 | .addOption('triggerIconName', options.triggerIconName, async (harness, triggerIconName) => { |
| 41 | const result = await harness.locatorForOptional( |
| 42 | MatIconHarness.with({name: triggerIconName}), |
| 43 | )(); |
| 44 | return result !== null; |
| 45 | }); |
| 46 | } |
| 47 | |
| 48 | /** Whether the menu is disabled. */ |
| 49 | async isDisabled(): Promise<boolean> { |
no test coverage detected