• Overview
@angular/cdk/testing

HarnessPredicate

Class

A class used to associate a ComponentHarness class with predicate functions that can be used to filter instances of the class to be matched.

API

  
    class HarnessPredicate<T extends ComponentHarness> {}
  
  

constructor

HarnessPredicate<T>
@paramharnessTypeComponentHarnessConstructor<T>
@paramoptionsBaseHarnessFilters
@returnsHarnessPredicate<T>

add

this

Adds a predicate function to be run against candidate harnesses.

@paramdescriptionstring

A description of this predicate that may be used in error messages.

@parampredicateAsyncPredicate<T>

An async predicate function.

@returnsthis

addOption

this

Adds a predicate function that depends on an option value to be run against candidate harnesses. If the option value is undefined, the predicate will be ignored.

@paramnamestring

The name of the option (may be used in error messages).

@paramoptionO | undefined

The option value.

@parampredicateAsyncOptionPredicate<T, O>

The predicate function to run if the option value is not undefined.

@returnsthis

filter

Promise<T[]>

Filters a list of harnesses on this predicate.

@paramharnessesT[]

The list of harnesses to filter.

@returnsPromise<T[]>

evaluate

Promise<boolean>

Evaluates whether the given harness satisfies this predicate.

@paramharnessT

The harness to check

@returnsPromise<boolean>

getDescription

string

Gets a description of this predicate for use in error messages.

@returnsstring

getSelector

string

Gets the selector used to find candidate elements.

@returnsstring

stringMatches

Promise<boolean>

Checks if the specified nullable string value matches the given pattern.

@paramvaluestring | Promise<string | null> | null

The nullable string value to check, or a Promise resolving to the nullable string value.

@parampatternstring | RegExp | null

The pattern the value is expected to match. If pattern is a string, value is expected to match exactly. If pattern is a regex, a partial match is allowed. If pattern is null, the value is expected to be null.

@returnsPromise<boolean>
Jump to details