Skip to content

Commit 2c1faf9

Browse files
committed
test(web): retain unlinked links alongside paste conversion
1 parent de5abf4 commit 2c1faf9

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

‎apps/web/src/components/composerInlineTokenPaste.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,22 @@ describe("importPastedComposerText", () => {
5555
expect(importPastedComposerText(clipboard({ "text/plain": pasted }), () => new Map())).toBe(
5656
pasted,
5757
);
58+
const record = threadContextRecord(thread, "Login");
59+
const link = "[Login](t3-thread://v2/env-1/thread-1)";
60+
for (const text of [chip("Login"), link]) {
61+
expect(
62+
importPastedComposerText(
63+
clipboard({
64+
"text/plain": text,
65+
[COMPOSER_CONTEXT_CLIPBOARD_MIME]: encodeComposerContextFragment({
66+
version: 1,
67+
source: { environmentId: thread.environmentId },
68+
records: [record],
69+
})!,
70+
}),
71+
() => new Map([[record.contextId, { markdown: link }]]),
72+
),
73+
).toBe(link);
74+
}
5875
});
5976
});

‎apps/web/src/components/composerInlineTokenPaste.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import { readThreadShell } from "~/state/entities";
2525
const threadTitle = (ref: ScopedThreadRef) => readThreadShell(ref)?.title;
2626

2727
/** Pasted thread links count as context too, so they become chips like a copied chip does. */
28-
2928
export function readPastedComposerContext(
3029
clipboardData: Pick<DataTransfer, "getData">,
3130
): ComposerContextClipboardFragment | null {

0 commit comments

Comments
 (0)