NG.III · Angular 22 practice question
A developer is writing an integration test for a component utilizing an `@defer` block. To ensure they can programmatically force the defer block through its lifecycle stages (e.g., from placeholder to loading to complete) within the test environment, what configuration must they apply to the testing module?
@defer {
<HeavyWidget />
} @placeholder {
Loading...
} @loading {
Fallback
}
Check answer and explanation
Correct answer: Set `TestBed.configureTestingModule({ deferBlockBehavior: DeferBlockBehavior.Manual });`
Explanation
The official documentation indicates that configuring the testing module with `deferBlockBehavior: DeferBlockBehavior.Manual` enables granular control over the defer block states during testing procedures.
Common trap
Attempting to configure the testing module using `deferBlockBehavior: DeferBlockBehavior.Forced` will fail because that enum value does not exist, and invoking `componentFixture.triggerDeferBlock(DeferBlockState.Manual)` describes an incorrect method for managing the block's state.
Source: Angular docs: Deferred loading with `@defer` — Testing `@defer` blocks
Checked against the cited text on 2026-11-25.