Co-authored-by: maria-rcks <[email protected]> Co-authored-by: Julius Marminge <[email protected]> Co-authored-by: Claude Code <[email protected]>
28 lines
957 B
TypeScript
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,
|
|
);
|
|
});
|
|
});
|