fix(editor): Improve touch device detection (#9675)

This commit is contained in:
Milorad FIlipović
2024-06-12 13:49:41 +02:00
committed by GitHub
parent dc17cf3a49
commit 3b86f52b02
3 changed files with 60 additions and 16 deletions

View File

@@ -44,3 +44,18 @@ export class IntersectionObserver {
window.IntersectionObserver = IntersectionObserver;
global.IntersectionObserver = IntersectionObserver;
// Mocks for useDeviceSupport
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: vi.fn().mockImplementation((query) => ({
matches: true,
media: query,
onchange: null,
addListener: vi.fn(),
removeListener: vi.fn(),
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
})),
});