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

Method with

src/material/card/testing/card-harness.ts:34–48  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

32 * @return a `HarnessPredicate` configured with the given options.
33 */
34 static with<T extends MatCardHarness>(
35 this: ComponentHarnessConstructor<T>,
36 options: CardHarnessFilters = {},
37 ): HarnessPredicate<T> {
38 return new HarnessPredicate(this, options)
39 .addOption('text', options.text, (harness, text) =>
40 HarnessPredicate.stringMatches(harness.getText(), text),
41 )
42 .addOption('title', options.title, (harness, title) =>
43 HarnessPredicate.stringMatches(harness.getTitleText(), title),
44 )
45 .addOption('subtitle', options.subtitle, (harness, subtitle) =>
46 HarnessPredicate.stringMatches(harness.getSubtitleText(), subtitle),
47 );
48 }
49
50 private _title = this.locatorForOptional('.mat-mdc-card-title');
51 private _subtitle = this.locatorForOptional('.mat-mdc-card-subtitle');

Callers 1

Calls 5

addOptionMethod · 0.80
stringMatchesMethod · 0.80
getSubtitleTextMethod · 0.80
getTextMethod · 0.45
getTitleTextMethod · 0.45

Tested by

no test coverage detected