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

Method with

src/material/core/testing/option-harness.ts:29–42  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 2

Calls 4

addOptionMethod · 0.80
stringMatchesMethod · 0.80
isSelectedMethod · 0.65
getTextMethod · 0.45

Tested by

no test coverage detected