fix: refactor document focus handling in test files - tests were failing in gitea CI

This commit is contained in:
arabcoders 2026-02-20 22:59:01 +03:00
parent befc7df583
commit 850a1b2eca
4 changed files with 12 additions and 4 deletions

View file

@ -8,7 +8,9 @@ globalThis.useNotificationStore = () => ({
markRead: () => {},
}) as any
;(globalThis.document as any).hasFocus = () => true
const documentStub: any = globalThis.document ?? {}
documentStub.hasFocus = () => true
;(globalThis as any).document = documentStub
mock.module('~/composables/useNotification', () => ({
useNotification: () => ({ success: successMock, error: errorMock }),

View file

@ -8,7 +8,9 @@ globalThis.useNotificationStore = () => ({
markRead: () => {},
}) as any
;(globalThis.document as any).hasFocus = () => true
const documentStub: any = globalThis.document ?? {}
documentStub.hasFocus = () => true
;(globalThis as any).document = documentStub
mock.module('~/composables/useNotification', () => ({
useNotification: () => ({ success: successMock, error: errorMock }),

View file

@ -8,7 +8,9 @@ globalThis.useNotificationStore = () => ({
markRead: () => {},
}) as any
;(globalThis.document as any).hasFocus = () => true
const documentStub: any = globalThis.document ?? {}
documentStub.hasFocus = () => true
;(globalThis as any).document = documentStub
mock.module('~/composables/useNotification', () => ({
useNotification: () => ({ success: successMock, error: errorMock }),

View file

@ -8,7 +8,9 @@ globalThis.useNotificationStore = () => ({
markRead: () => {},
}) as any
;(globalThis.document as any).hasFocus = () => true
const documentStub: any = globalThis.document ?? {}
documentStub.hasFocus = () => true
;(globalThis as any).document = documentStub
mock.module('~/composables/useNotification', () => ({
useNotification: () => ({ success: successMock, error: errorMock }),