MCPcopy Create free account
hub / github.com/angular/components / with

Method with

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

* Gets a `HarnessPredicate` that can be used to search for a menu item with specific attributes. * @param options Options for filtering which menu item instances are considered a match. * @return a `HarnessPredicate` configured with the given options.

(
    this: ComponentHarnessConstructor<T>,
    options: MenuItemHarnessFilters = {},
  )

Source from the content-addressed store, hash-verified

154 * @return a `HarnessPredicate` configured with the given options.
155 */
156 static with<T extends MatMenuItemHarness>(
157 this: ComponentHarnessConstructor<T>,
158 options: MenuItemHarnessFilters = {},
159 ): HarnessPredicate<T> {
160 return new HarnessPredicate(this, options)
161 .addOption('text', options.text, (harness, text) =>
162 HarnessPredicate.stringMatches(harness.getText(), text),
163 )
164 .addOption(
165 'hasSubmenu',
166 options.hasSubmenu,
167 async (harness, hasSubmenu) => (await harness.hasSubmenu()) === hasSubmenu,
168 );
169 }
170
171 /** Whether the menu is disabled. */
172 async isDisabled(): Promise<boolean> {

Callers

nothing calls this directly

Calls 4

addOptionMethod · 0.80
stringMatchesMethod · 0.80
getTextMethod · 0.45
hasSubmenuMethod · 0.45

Tested by

no test coverage detected