Skip to main content
Version: 14.1

Class: SpectacularPipeHarness<TValue>

A harness for testing an Angular pipe.

Includes an API to write a value and read the rendered text.

Type parameters

Name
TValue

Constructors

constructor

new SpectacularPipeHarness<TValue>()

Type parameters

Name
TValue

Accessors

template

Abstract set template(template): void

Replace the pipe component template.

NOTE! The value property is in context of the specified template.

Parameters

NameTypeDescription
templatestringThe component template used to test the Angular pipe, for example '{{ value \| camelize }}'.

Returns

void

Defined in

packages/spectacular/src/lib/pipe-testing/pipe-harness/spectacular-pipe-harness.ts:23


text

Abstract get text(): string

Read the text rendered in the pipe component template.

Returns

string

Defined in

packages/spectacular/src/lib/pipe-testing/pipe-harness/spectacular-pipe-harness.ts:27


value

Abstract set value(value): void

Update the value passed through the Angular pipe.

Parameters

NameTypeDescription
valuenull | TValue | Observable<TValue>The new value.

Returns

void

Defined in

packages/spectacular/src/lib/pipe-testing/pipe-harness/spectacular-pipe-harness.ts:33

Methods

inject

Abstract inject<T>(token, notFoundValue?, flags?): T

Resolve a dependency based on the specified dependency injection token.

Type parameters

Name
T

Parameters

NameTypeDescription
tokenType<T> | InjectionToken<T> | AbstractType<T>The token representing the dependency, that is a class or an InjectionToken.
notFoundValue?TThe default value in case the specified dependency has not been provided. Optional. Default is null.
flags?InjectFlagsDependency injection options, for example InjectFlags.Optional \| InjectFlags.SkipSelf. Optional. Default is InjectFlags.Default.

Returns

T

Defined in

packages/spectacular/src/lib/pipe-testing/pipe-harness/spectacular-pipe-harness.ts:46

Abstract inject<T>(token, notFoundValue, flags?): null | T

Type parameters

Name
T

Parameters

NameType
tokenType<T> | InjectionToken<T> | AbstractType<T>
notFoundValuenull
flags?InjectFlags

Returns

null | T

Defined in

packages/spectacular/src/lib/pipe-testing/pipe-harness/spectacular-pipe-harness.ts:51