The best way to control Claude Code, Codex and more from any computer or phone
test(web): ChatMarkdown thread find waits for highlights to settle (#21121)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 18, 2026 at 00:19 UTC
d0918f1659f4c19172796c8d1910ca6e4bc18b51
1 file changed
+8
-4
apps/web/src/components/ChatMarkdown.browser.test.tsx
+8
-4
@@ -830,10 +830,14 @@ describe("ChatMarkdown thread find", () => {
830
),
831
);
832
await frame();
833
- const ranges = [...CSS.highlights.values()].flatMap((value) => [...value]);
834
- expect(ranges.map((range) => (range as Range).toString())).toEqual(
835
- Array.from({ length: count }, () => query),
836
- );
833
+ // Lazy blocks such as Mermaid can swap their source text after the first frame,
834
+ // emptying a range for a moment, so wait for the highlights to settle.
835
+ await vi.waitFor(() => {
836
+ const ranges = [...CSS.highlights.values()].flatMap((value) => [...value]);
837
+ expect(ranges.map((range) => (range as Range).toString())).toEqual(
838
+ Array.from({ length: count }, () => query),
839
+ );
840
+ });
841
const segments =
842
searchableMessageSegments(
843
{ role: user ? "user" : "assistant", text, streaming: false },