- Rename 132 *.vitest.mjs -> *.vitest.ts - Rename vitest.setup.mjs -> vitest.setup.ts - Rename helpers/vitestEnvironment.mjs -> vitestEnvironment.ts - Delete settings_store.test.mjs (Node test runner, superseded by .vitest.ts) - Fix .mjs imports in vitest.setup.ts and grid_loader_adaptive_paging.vitest.ts Config updates: - vitest.config.mjs: setupFiles, include, coverage.include -> .ts - tsconfig.test.json: new dedicated config for test files (strict:false) - knip.json: update project pattern for tests - package.json: add typecheck:tests script (audit-only)
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { beforeEach, describe, expect, it } from "vitest";
|
|
|
|
import {
|
|
clearAssetDragStartCleanup,
|
|
consumeInternalDropOccurred,
|
|
getAssetDragStartCleanup,
|
|
markInternalDropOccurred,
|
|
resetDndRuntimeState,
|
|
setAssetDragStartCleanup,
|
|
} from "../features/dnd/runtimeState.js";
|
|
|
|
describe("dnd runtime state", () => {
|
|
beforeEach(() => {
|
|
resetDndRuntimeState();
|
|
});
|
|
|
|
it("consumes the internal drop flag exactly once", () => {
|
|
expect(consumeInternalDropOccurred()).toBe(false);
|
|
|
|
markInternalDropOccurred();
|
|
expect(consumeInternalDropOccurred()).toBe(true);
|
|
expect(consumeInternalDropOccurred()).toBe(false);
|
|
});
|
|
|
|
it("tracks dragstart cleanup per container without DOM expandos", () => {
|
|
const container = {};
|
|
const cleanup = () => {};
|
|
|
|
expect(getAssetDragStartCleanup(container)).toBeNull();
|
|
|
|
setAssetDragStartCleanup(container, cleanup);
|
|
expect(getAssetDragStartCleanup(container)).toBe(cleanup);
|
|
|
|
clearAssetDragStartCleanup(container);
|
|
expect(getAssetDragStartCleanup(container)).toBeNull();
|
|
});
|
|
});
|