Files
t3code/apps/web/src/components/composerSelection.test.ts
T
5b8445b7a7 fix(web): collapse the resting composer (#7855)
Co-authored-by: maria-rcks <[email protected]>
Co-authored-by: Julius Marminge <[email protected]>
Co-authored-by: Claude Code <[email protected]>
2026-09-02 23:53:41 -07:00

28 lines
957 B
TypeScript

import { describe, expect, it } from "vite-plus/test";
import { didComposerSelectionChangeVisibly } from "./composerSelection";
describe("didComposerSelectionChangeVisibly", () => {
it("ignores selection-neutral editor updates", () => {
expect(didComposerSelectionChangeVisibly({ start: 3, end: 3 }, null)).toBe(false);
expect(didComposerSelectionChangeVisibly({ start: 3, end: 3 }, { start: 3, end: 3 })).toBe(
false,
);
});
it("detects entering and extending a visible range selection", () => {
expect(didComposerSelectionChangeVisibly({ start: 3, end: 3 }, { start: 0, end: 3 })).toBe(
true,
);
expect(didComposerSelectionChangeVisibly({ start: 1, end: 3 }, { start: 0, end: 3 })).toBe(
true,
);
});
it("does not repeatedly report the same visible selection", () => {
expect(didComposerSelectionChangeVisibly({ start: 0, end: 3 }, { start: 0, end: 3 })).toBe(
false,
);
});
});