mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
test(playback): let the overlay's signal write schedule its own render
Review follow-up (Greptile): the test forced a render with fixture.detectChanges() after the debounce timer, so it would pass even if the signal write stopped scheduling an OnPush render. It now runs the fixture with autoDetectChanges and only advances the fake timers; with plain fields under OnPush the overlay never renders and the test fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
420e4a0f2f
commit
5b78a51dae
1 file changed
+7
-5
+7
-5
@@ -252,20 +252,22 @@ describe('VideoPlayerComponent fullscreen channel panel + zapping', () => {
|
||||
});
|
||||
|
||||
// OnPush: the overlay hides from a 2 s timer, outside any template
|
||||
// event, so it must leave the DOM without a zone-triggered tick.
|
||||
it('hides the channel-number overlay when its debounce fires', () => {
|
||||
// event, so the signal write itself must schedule the render. The test
|
||||
// never forces one after the timer: a plain-field write would leave the
|
||||
// overlay in the DOM.
|
||||
it('hides the channel-number overlay when its debounce fires', async () => {
|
||||
jest.useFakeTimers();
|
||||
try {
|
||||
const overlay = () =>
|
||||
(fixture.nativeElement as HTMLElement).querySelector(
|
||||
'.channel-number-overlay'
|
||||
);
|
||||
fixture.autoDetectChanges();
|
||||
component.handleChannelNumberInput('2');
|
||||
fixture.detectChanges();
|
||||
await jest.advanceTimersByTimeAsync(50);
|
||||
expect(overlay()?.textContent).toBe('2');
|
||||
|
||||
jest.advanceTimersByTime(2000);
|
||||
fixture.detectChanges();
|
||||
await jest.advanceTimersByTimeAsync(2000);
|
||||
|
||||
expect(overlay()).toBeNull();
|
||||
expect(storeMock.dispatch).toHaveBeenCalledWith(
|
||||
|
||||
Reference in new issue
Block a user