Files
MajoorWaldi-ComfyUI-Majoor-…/ui/tests/dnd_runtime_state.vitest.ts
T
Ewald 85a82f130a test: migrate ui/tests from .mjs to .ts
- 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)
2026-05-26 13:04:05 +02:00

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();
});
});