MCPcopy Index your code
hub / github.com/angular/components / with

Method with

src/material/menu/testing/menu-harness.ts:32–46  ·  view source on GitHub ↗

* 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 = {},
  )

Source from the content-addressed store, hash-verified

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> {

Callers 2

getItemsMethod · 0.45

Calls 4

addOptionMethod · 0.80
stringMatchesMethod · 0.80
locatorForOptionalMethod · 0.80
getTriggerTextMethod · 0.45

Tested by

no test coverage detected