Member Junction
    Preparing search index...

    Interface RenderComponentFixtureOptions<T>

    interface RenderComponentFixtureOptions<T> {
        autoDetect?: boolean;
        declarations?: Type<unknown>[];
        imports?: (Type<unknown> | ModuleWithProviders<object>)[];
        inputs?: Record<string, unknown>;
        providers?: Provider[];
        setup?: (instance: T, ref: ComponentRef<T>) => void;
    }

    Type Parameters

    • T

      the component type being rendered.

    Index

    Properties

    autoDetect?: boolean

    Use autoDetectChanges() instead of a single detectChanges(). Set this for components that mutate their own state during init/CD (recompute a bound value in ngOnInit/ngOnChanges), which would otherwise trip the dev-mode NG0100 check.

    declarations?: Type<unknown>[]

    Components/directives to declare. Pass these for a module-declared (standalone: false) component that you configure via inputs (not projected children) — include the component itself plus any child components it renders. Standalone components need neither imports nor declarations.

    imports?: (Type<unknown> | ModuleWithProviders<object>)[]

    Modules to import (e.g. CommonModule, FormsModule). Provide when the component (or a declarations entry) needs them.

    inputs?: Record<string, unknown>

    @Inputs to apply, by name. Set via componentRef.setInput, which is the zoneless-correct way to mark the view dirty (avoids the NG0100 ExpressionChangedAfterItHasBeenCheckedError that bites when state is mutated after the first change-detection pass). See guides/ANGULAR_TESTING_GUIDE.md §5.

    providers?: Provider[]

    Providers to register in the testing module — supply stub/fake versions of any services the component injects via its constructor. A component with constructor-injected services cannot even be constructed without these, so this is the seam for presentational components that take services but only touch them in event handlers (not during render). Prefer minimal { provide: X, useValue: ... } stubs over the real service. See guides/ANGULAR_TESTING_GUIDE.md.

    setup?: (instance: T, ref: ComponentRef<T>) => void

    Imperative setup run AFTER inputs are applied but BEFORE the first detectChanges() — call component methods, set internal state, or wire spies to @Outputs. Receives the live component instance and its ComponentRef. Running before the single render is what keeps the test NG0100-safe.