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

Method with

src/material/stepper/testing/step-harness.ts:27–47  ·  view source on GitHub ↗

* Gets a `HarnessPredicate` that can be used to search for a `MatStepHarness` that meets * certain criteria. * @param options Options for filtering which steps are considered a match. * @return a `HarnessPredicate` configured with the given options.

(options: StepHarnessFilters = {})

Source from the content-addressed store, hash-verified

25 * @return a `HarnessPredicate` configured with the given options.
26 */
27 static with(options: StepHarnessFilters = {}): HarnessPredicate<MatStepHarness> {
28 return new HarnessPredicate(MatStepHarness, options)
29 .addOption('label', options.label, (harness, label) =>
30 HarnessPredicate.stringMatches(harness.getLabel(), label),
31 )
32 .addOption(
33 'selected',
34 options.selected,
35 async (harness, selected) => (await harness.isSelected()) === selected,
36 )
37 .addOption(
38 'completed',
39 options.completed,
40 async (harness, completed) => (await harness.isCompleted()) === completed,
41 )
42 .addOption(
43 'invalid',
44 options.invalid,
45 async (harness, invalid) => (await harness.hasErrors()) === invalid,
46 );
47 }
48
49 /** Gets the label of the step. */
50 async getLabel(): Promise<string> {

Callers 1

Calls 6

addOptionMethod · 0.80
stringMatchesMethod · 0.80
isCompletedMethod · 0.80
getLabelMethod · 0.65
isSelectedMethod · 0.65
hasErrorsMethod · 0.45

Tested by

no test coverage detected