mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-15 00:54:06 -08:00
64 lines
1.1 KiB
TypeScript
64 lines
1.1 KiB
TypeScript
import '@testing-library/jest-dom';
|
|
import { configure } from '@testing-library/vue';
|
|
|
|
configure({ testIdAttribute: 'data-test-id' });
|
|
|
|
window.ResizeObserver =
|
|
window.ResizeObserver ||
|
|
vi.fn().mockImplementation(() => ({
|
|
disconnect: vi.fn(),
|
|
observe: vi.fn(),
|
|
unobserve: vi.fn(),
|
|
}));
|
|
|
|
Element.prototype.scrollIntoView = vi.fn();
|
|
|
|
Range.prototype.getBoundingClientRect = vi.fn();
|
|
Range.prototype.getClientRects = vi.fn(() => ({
|
|
item: vi.fn(),
|
|
length: 0,
|
|
[Symbol.iterator]: vi.fn(),
|
|
}));
|
|
|
|
export class IntersectionObserver {
|
|
root = null;
|
|
|
|
rootMargin = '';
|
|
|
|
thresholds = [];
|
|
|
|
disconnect() {
|
|
return null;
|
|
}
|
|
|
|
observe() {
|
|
return null;
|
|
}
|
|
|
|
takeRecords() {
|
|
return [];
|
|
}
|
|
|
|
unobserve() {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
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(),
|
|
})),
|
|
});
|