beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
...
],
imports: [
RouterTestingModule.withRoutes(routes),
...
],
providers: [
{provide: HttpClient, useValue: httpClientSpy },
]
})
.compileComponents();
router = TestBed.get(Router);
fixture = TestBed.createComponent(ReferentielBuPilotageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
await fixture.whenStable();
});
it('--------', fakeAsync( () => {
// click to change page
const buttonShow: HTMLInputElement = document.querySelector('.bg-action');
buttonShow.click();
tick();
// another page
fixture.detectChanges();
fixture.whenStable().then(() => {
const tds2: NodeListOf<HTMLElement> = document.querySelectorAll('td');
// tds2 is empty
// he must have td's if he changed the page
I have the impression that the tick does not detect the page change