Skip to main content
Version: 15.0

Interface: SpectacularApplicationHarness

A harness for testing application-level software artifacts.

Properties

rootComponent

Readonly rootComponent: SpectacularAppComponent

The bootstrapped component.

Defined in

packages/spectacular/src/lib/application-testing/application-harness/spectacular-application-harness.ts:74


rootFixture

Readonly rootFixture: ComponentFixture<SpectacularAppComponent>

The component fixture for the bootstrapped component.

Defined in

packages/spectacular/src/lib/application-testing/application-harness/spectacular-application-harness.ts:78

Methods

inject

inject<T>(token, notFoundValue, options): T

Resolve a dependency based on the specified dependency injection token.

Throws

When the notFoundValue is undefined or Injector.THROW_IF_NOT_FOUND

Type parameters

Name
T

Parameters

NameTypeDescription
tokenProviderToken<T>The token representing the dependency, that is a class or an InjectionToken.
notFoundValueundefinedThe default value in case the specified dependency has not been provided. Optional. Default is null.
optionsInjectOptions & { optional?: false }Dependency injection options. Optional.

Returns

T

The instance from the injector if defined, otherwise the notFoundValue.

Defined in

packages/spectacular/src/lib/application-testing/application-harness/spectacular-application-harness.ts:20

inject<T>(token, notFoundValue, options): null | T

Type parameters

Name
T

Parameters

NameType
tokenProviderToken<T>
notFoundValueundefined | null
optionsInjectOptions

Returns

null | T

Defined in

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

inject<T>(token, notFoundValue?, options?): T

Type parameters

Name
T

Parameters

NameType
tokenProviderToken<T>
notFoundValue?T
options?InjectOptions

Returns

T

Defined in

packages/spectacular/src/lib/application-testing/application-harness/spectacular-application-harness.ts:32

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

Resolve a dependency based on the specified dependency injection token.

Throws

When the notFoundValue is undefined or Injector.THROW_IF_NOT_FOUND

Deprecated

Use object-based flags (InjectOptions) instead.

Type parameters

Name
T

Parameters

NameTypeDescription
tokenProviderToken<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

The instance from the injector if defined, otherwise the notFoundValue.

Defined in

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

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

Resolve a dependency based on the specified dependency injection token.

Throws

When the notFoundValue is undefined or Injector.THROW_IF_NOT_FOUND

Deprecated

Use object-based flags (InjectOptions) instead.

Type parameters

Name
T

Parameters

NameTypeDescription
tokenProviderToken<T>The token representing the dependency, that is a class or an InjectionToken.
notFoundValuenullThe 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

null | T

The instance from the injector if defined, otherwise the notFoundValue.

Defined in

packages/spectacular/src/lib/application-testing/application-harness/spectacular-application-harness.ts:66