Hi, I'm not sure if this is a bug. I'm having trouble setting up a test case for a component with an @defer block using MockBuilder. Any insights?
@Component({
selector: 'app-test',
standalone: true,
templateUrl: './test.component.html',
})
class TestComponent {
}
@defer (on viewport) {
<div>text</div>
} @placeholder {
<div>placeholder</div>
}
describe('TestComponent', () => {
let fixture: ComponentFixture<TestComponent>;
beforeEach(async () => {
return MockBuilder(TestComponent)
.beforeCompileComponents(testBed => {
testBed.configureTestingModule({deferBlockBehavior: DeferBlockBehavior.Manual});
});
});
beforeEach(async () => {
fixture = TestBed.createComponent(TestComponent);
});
describe('template', () => {
it('whenStable', async () => {
await fixture.whenStable();
const deferBlockFixtures: DeferBlockFixture[] = await fixture.getDeferBlocks();
expect(deferBlockFixtures.length).toEqual(1);
});
});
});
Number of DeferBlockFixture seems always to be zero no matter How I set up the test case?
https://angular.dev/guide/templates/defer#testing-defer-blocks
Hi, I'm not sure if this is a bug. I'm having trouble setting up a test case for a component with an @defer block using MockBuilder. Any insights?
Number of DeferBlockFixture seems always to be zero no matter How I set up the test case?
https://angular.dev/guide/templates/defer#testing-defer-blocks