MCPcopy
hub / github.com/angular/components / with

Method with

src/material/chips/testing/chip-harness.ts:36–47  ·  view source on GitHub ↗

* Gets a `HarnessPredicate` that can be used to search for a chip with specific attributes. * @param options Options for narrowing the search. * @return a `HarnessPredicate` configured with the given options.

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

Source from the content-addressed store, hash-verified

34 * @return a `HarnessPredicate` configured with the given options.
35 */
36 static with<T extends MatChipHarness>(
37 this: ComponentHarnessConstructor<T>,
38 options: ChipHarnessFilters = {},
39 ): HarnessPredicate<T> {
40 return new HarnessPredicate(this, options)
41 .addOption('text', options.text, (harness, label) => {
42 return HarnessPredicate.stringMatches(harness.getText(), label);
43 })
44 .addOption('disabled', options.disabled, async (harness, disabled) => {
45 return (await harness.isDisabled()) === disabled;
46 });
47 }
48
49 /** Gets a promise for the text content the option. */
50 async getText(): Promise<string> {

Callers 9

geEditButtonMethod · 0.45
getRemoveButtonMethod · 0.45
getAvatarMethod · 0.45
getEditInputMethod · 0.45

Calls 4

addOptionMethod · 0.80
stringMatchesMethod · 0.80
getTextMethod · 0.45
isDisabledMethod · 0.45

Tested by

no test coverage detected