test: pin document.hasFocus in status timer test (useViewedInterval gating)
This commit is contained in:
@@ -19,6 +19,10 @@ describe('ResponseLoadingIndicator timer', () => {
|
||||
beforeEach(() => {
|
||||
vi.useFakeTimers()
|
||||
vi.setSystemTime(new Date('2026-01-01T00:00:00.000Z'))
|
||||
// useViewedInterval gates ticking on document focus + visibility; jsdom's
|
||||
// hasFocus() is unreliable across runners, so pin it (same as the
|
||||
// background-sync backstop tests).
|
||||
vi.spyOn(document, 'hasFocus').mockReturnValue(true)
|
||||
__resetElapsedTimerRegistryForTests()
|
||||
})
|
||||
|
||||
@@ -27,6 +31,7 @@ describe('ResponseLoadingIndicator timer', () => {
|
||||
$activeSessionId.set(null)
|
||||
$turnStartedAt.set(null)
|
||||
__resetElapsedTimerRegistryForTests()
|
||||
vi.restoreAllMocks()
|
||||
vi.useRealTimers()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user