import "@testing-library/jest-dom";

// jsdom does not implement ResizeObserver — polyfill it for tests that need it
if (typeof ResizeObserver === "undefined") {
  class ResizeObserver {
    observe() {}
    unobserve() {}
    disconnect() {}
  }
  (globalThis as unknown as Record<string, unknown>).ResizeObserver = ResizeObserver;
}

// jsdom does not implement PointerEvent — polyfill it for tests that need it
if (typeof PointerEvent === "undefined") {
  class PointerEvent extends MouseEvent {
    pointerId?: number;
    constructor(type: string, params: PointerEventInit = {}) {
      super(type, params);
      this.pointerId = params.pointerId;
    }
  }
  (globalThis as unknown as Record<string, unknown>).PointerEvent = PointerEvent;
}
