@mitcsutt/kiln-dnd
Version:
Kiln drag and drop: sortable lists, boards, drop zones and grid layouts with one keyboard model and one announcer, rendered through kiln-ui
19 lines (18 loc) • 682 B
TypeScript
/**
* Stubs the browser APIs the drag engine calls and jsdom doesn't implement
* (`ResizeObserver`, `matchMedia`, the Popover API, `getAnimations`,
* `elementFromPoint`), so components from `@mitcsutt/kiln-dnd` render and respond to the
* keyboard in a jsdom test. Call it once in your test setup file.
*
* jsdom has no layout, so pointer drags (which measure where things are) still need a
* real browser; keyboard dragging works in jsdom because it moves in data space.
*
* @example
* ```ts
* // vitest.setup.ts
* import { stubDndBrowserApis } from '@mitcsutt/kiln-dnd/testing'
*
* stubDndBrowserApis()
* ```
*/
export declare function stubDndBrowserApis(): void;