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

Method with

src/material/tabs/testing/tab-harness.ts:27–40  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

25 * @return a `HarnessPredicate` configured with the given options.
26 */
27 static with<T extends MatTabHarness>(
28 this: ComponentHarnessConstructor<T>,
29 options: TabHarnessFilters = {},
30 ): HarnessPredicate<T> {
31 return new HarnessPredicate(this, options)
32 .addOption('label', options.label, (harness, label) =>
33 HarnessPredicate.stringMatches(harness.getLabel(), label),
34 )
35 .addOption(
36 'selected',
37 options.selected,
38 async (harness, selected) => (await harness.isSelected()) == selected,
39 );
40 }
41
42 /** Gets the label of the tab. */
43 async getLabel(): Promise<string> {

Callers 1

Calls 4

addOptionMethod · 0.80
stringMatchesMethod · 0.80
getLabelMethod · 0.65
isSelectedMethod · 0.65

Tested by

no test coverage detected