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

Method with

src/material/select/testing/select-harness.ts:33–44  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

31 * @return a `HarnessPredicate` configured with the given options.
32 */
33 static with<T extends MatSelectHarness>(
34 this: ComponentHarnessConstructor<T>,
35 options: SelectHarnessFilters = {},
36 ): HarnessPredicate<T> {
37 return new HarnessPredicate(this, options)
38 .addOption('disabled', options.disabled, async (harness, disabled) => {
39 return (await harness.isDisabled()) === disabled;
40 })
41 .addOption('label', options.label, (harness, label) => {
42 return HarnessPredicate.stringMatches(harness.getLabel(), label);
43 });
44 }
45
46 /** Gets a boolean promise indicating if the select is disabled. */
47 async isDisabled(): Promise<boolean> {

Callers 3

getOptionsMethod · 0.45
getOptionGroupsMethod · 0.45

Calls 4

addOptionMethod · 0.80
stringMatchesMethod · 0.80
getLabelMethod · 0.65
isDisabledMethod · 0.45

Tested by

no test coverage detected