* 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 = {})
| 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> { |
no test coverage detected