Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): Open in editor on a chat file chip opens the file the chip names #18389

Mergedchickenputty(GitHub profile, opens in a new tab)merged 6 commits intomain fromrefs/pull/18389/headmerged by juliusmarminge View on GitHub

Showing 4 changed files with 119 additions and 16 deletions (loading 1).

x
0 of 4 viewed, 4 left
24 additions and 0 deletionsapps/web/src/components/ChatMarkdown.permissions.browser.test.tsxModified
View file
@@ -146,6 +146,10 @@
state.copy.mockReset().mockResolvedValue(undefined);
useRightPanelStore.setState({ openFile: state.openFile });
vi.spyOn(navigator.clipboard, "writeText").mockImplementation(state.copy);
+ vi.spyOn(navigator.clipboard, "write").mockImplementation(async (items) => {
+ const item = items[0]!;
+ await state.copy(await (await item.getType("text/plain")).text());
+ });
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
});
​
@@ -202,6 +206,26 @@
expect(state.openEditor).not.toHaveBeenCalled();
});
​
+it("starts copying before the nested-file lookup finishes", async () => {
+ let finishLookup: () => void = () => {
+ throw new Error("Lookup not started");
+ };
+ state.search.mockImplementationOnce(
+ () =>
+ new Promise((resolve) => {
+ finishLookup = () =>
+ resolve(AsyncResult.success({ entries: [{ path: "src/readme.md", kind: "file" }] }));
+ }),
+ );
+ state.choose.mockResolvedValue("copy-full");
+ await renderMarkdown("`readme.md:10:2`");
+ await openContextMenu();