Skip to content

Commit ef9d15a

Browse files
juliusmarmingecodex
andcommitted
Fix cursor regression test for PR #4167
Co-authored-by: codex <[email protected]>
1 parent 5e19968 commit ef9d15a

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎apps/web/src/composer-logic.test.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,21 @@ describe("collapseExpandedComposerCursor", () => {
246246
);
247247
});
248248

249-
it("keeps replacement cursors aligned when another mention already exists earlier", () => {
249+
it("keeps package-like text expanded when another mention already exists earlier", () => {
250250
const text = "open @AGENTS.md then @src/index.ts ";
251251
const expandedCursor = text.length;
252252
const collapsedCursor = collapseExpandedComposerCursor(text, expandedCursor);
253253

254-
expect(collapsedCursor).toBe("open ".length + 1 + " then ".length + 2);
254+
expect(collapsedCursor).toBe("open ".length + 1 + " then @src/index.ts ".length);
255+
expect(expandCollapsedComposerCursor(text, collapsedCursor)).toBe(expandedCursor);
256+
});
257+
258+
it("collapses only genuine mentions when package-like text exists earlier", () => {
259+
const text = "install @scope/pkg then @README.md ";
260+
const expandedCursor = text.length;
261+
const collapsedCursor = collapseExpandedComposerCursor(text, expandedCursor);
262+
263+
expect(collapsedCursor).toBe("install @scope/pkg then ".length + 1 + " ".length);
255264
expect(expandCollapsedComposerCursor(text, collapsedCursor)).toBe(expandedCursor);
256265
});
257266

0 commit comments

Comments
 (0)