Skip to content

Commit 776ec70

Browse files
test(web): await workflow script highlighting inside act
1 parent be73f95 commit 776ec70

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎apps/web/src/components/chat/WorkflowOpeningBlock.browser.test.tsx‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { afterEach, beforeEach, expect, it, vi } from "vite-plus/test";
66

77
import "~/index.css";
88

9+
import { getSyntaxHighlighterPromise } from "../../lib/syntaxHighlighting";
910
import { AppAtomRegistryProvider } from "../../rpc/atomRegistry";
1011
import { MarkdownFindContext } from "./markdownFindContext";
1112
import { useThreadFindHighlights } from "./threadFindHighlights";
@@ -99,8 +100,17 @@ const foldToggle = () =>
99100

100101
it("shows a short script as highlighted code with nothing to open", async () => {
101102
await render(SHORT_SCRIPT);
103+
await act(async () => {
104+
await getSyntaxHighlighterPromise("javascript");
105+
});
102106
expect(host.querySelector('[data-language="javascript"]')?.textContent).toContain("SCRIPTONLY");
103-
await vi.waitFor(() => expect(host.querySelector(".chat-markdown-shiki")).not.toBeNull());
107+
expect(host.querySelector(".chat-markdown-shiki")?.textContent).toContain(SHORT_SCRIPT);
108+
const tokenColors = new Set(
109+
[...host.querySelectorAll(".chat-markdown-shiki code span[style]")].map(
110+
(token) => getComputedStyle(token).color,
111+
),
112+
);
113+
expect(tokenColors.size).toBeGreaterThan(1);
104114
expect(foldToggle()).toBeUndefined();
105115
});
106116

0 commit comments

Comments
 (0)