The best way to control Claude Code, Codex and more from any computer or phone
test(web): stabilize timeline module setup
maria-rcks committed
Jul 22, 2026 at 23:36 UTC
39cd15b9543af45dd8aed75612bf9baebe92abbd
1 file changed
+19
-28
apps/web/src/components/chat/MessagesTimeline.test.tsx
+19
-28
@@ -130,7 +130,9 @@ function matchMedia() {
130
};
131
}
132
133
-beforeAll(() => {
133
+let MessagesTimeline: typeof import("./MessagesTimeline").MessagesTimeline;
134
+
135
+beforeAll(async () => {
136
const classList = {
137
add: () => {},
138
remove: () => {},
@@ -161,7 +163,9 @@ beforeAll(() => {
163
offsetHeight: 0,
164
},
165
});
164
-});
166
+
167
+ ({ MessagesTimeline } = await import("./MessagesTimeline"));
168
+}, 30_000);
169
170
const ACTIVE_THREAD_ENVIRONMENT_ID = EnvironmentId.make("environment-local");
171
const MESSAGE_CREATED_AT = "2026-03-17T19:12:28.000Z";
@@ -219,8 +223,7 @@ function buildUserTimelineEntry(text: string) {
223
}
224
225
describe("MessagesTimeline", () => {
222
- it("uses the larger leading inset only when the top fade is enabled", async () => {
223
- const { MessagesTimeline } = await import("./MessagesTimeline");
226
+ it("uses the larger leading inset only when the top fade is enabled", () => {
227
const timelineEntries = [buildUserTimelineEntry("Hello")];
228
229
const compactMarkup = renderToStaticMarkup(
@@ -236,8 +239,7 @@ describe("MessagesTimeline", () => {
239
expect(fadedMarkup).toContain("chat-timeline-scroll-fade");
240
});
241
239
- it("keeps assistant changed-files headers sticky below the thread header", async () => {
240
- const { MessagesTimeline } = await import("./MessagesTimeline");
242
+ it("keeps assistant changed-files headers sticky below the thread header", () => {
243
const assistantMessageId = MessageId.make("message-assistant-with-files");
244
const turnId = TurnId.make("turn-with-files");
245
const markup = renderToStaticMarkup(
@@ -349,8 +351,7 @@ describe("MessagesTimeline", () => {
351
expect(resolveTimelineMinimapInteractiveWidth(40, true)).toBe("22rem");
352
});
353
352
- it("anchors a sent attachment message using its measured height", async () => {
353
- const { MessagesTimeline } = await import("./MessagesTimeline");
354
+ it("anchors a sent attachment message using its measured height", () => {
355
const onAnchorReady = vi.fn();
356
const onAnchorSizeChanged = vi.fn();
357
const firstEntry = buildUserTimelineEntry("First prompt.");
@@ -398,8 +399,7 @@ describe("MessagesTimeline", () => {
399
expect(onAnchorSizeChanged).toHaveBeenCalledWith(secondEntry.message.id, 240);
400
});
401
401
- it("renders collapse controls for long user messages", async () => {
402
- const { MessagesTimeline } = await import("./MessagesTimeline");
402
+ it("renders collapse controls for long user messages", () => {
403
const markup = renderToStaticMarkup(
404
<MessagesTimeline
405
{...buildProps()}
@@ -418,8 +418,7 @@ describe("MessagesTimeline", () => {
418
expect(markup).toContain('data-user-message-footer="true"');
419
});
420
421
- it("does not render collapse controls for short user messages", async () => {
422
- const { MessagesTimeline } = await import("./MessagesTimeline");
421
+ it("does not render collapse controls for short user messages", () => {
422
const markup = renderToStaticMarkup(
423
<MessagesTimeline
424
{...buildProps()}
@@ -431,8 +430,7 @@ describe("MessagesTimeline", () => {
430
expect(markup).toContain('data-user-message-collapsible="false"');
431
});
432
434
- it("renders inline terminal labels with the composer chip UI", async () => {
435
- const { MessagesTimeline } = await import("./MessagesTimeline");
433
+ it("renders inline terminal labels with the composer chip UI", () => {
434
const markup = renderToStaticMarkup(
435
<MessagesTimeline
436
{...buildProps()}
@@ -459,8 +457,7 @@ describe("MessagesTimeline", () => {
457
expect(markup).toContain("Show full message");
458
}, 20_000);
459
462
- it("renders chips for standalone element-pick context messages", async () => {
463
- const { MessagesTimeline } = await import("./MessagesTimeline");
460
+ it("renders chips for standalone element-pick context messages", () => {
461
const markup = renderToStaticMarkup(
462
<MessagesTimeline
463
{...buildProps()}
@@ -486,8 +483,7 @@ describe("MessagesTimeline", () => {
483
expect(markup).not.toContain("<element_context");
484
});
485
489
- it("keeps the copy button for collapsed long user messages", async () => {
490
- const { MessagesTimeline } = await import("./MessagesTimeline");
486
+ it("keeps the copy button for collapsed long user messages", () => {
487
const markup = renderToStaticMarkup(
488
<MessagesTimeline
489
{...buildProps()}
@@ -500,8 +496,7 @@ describe("MessagesTimeline", () => {
496
expect(markup).toContain('data-user-message-footer="true"');
497
});
498
503
- it("renders context compaction entries in the normal work log", async () => {
504
- const { MessagesTimeline } = await import("./MessagesTimeline");
499
+ it("renders context compaction entries in the normal work log", () => {
500
const markup = renderToStaticMarkup(
501
<MessagesTimeline
502
{...buildProps()}
@@ -525,8 +520,7 @@ describe("MessagesTimeline", () => {
520
expect(markup).toContain("Work Log");
521
});
522
528
- it("formats changed file paths from the workspace root", async () => {
529
- const { MessagesTimeline } = await import("./MessagesTimeline");
523
+ it("formats changed file paths from the workspace root", () => {
524
const markup = renderToStaticMarkup(
525
<MessagesTimeline
526
{...buildProps()}
@@ -552,8 +546,7 @@ describe("MessagesTimeline", () => {
546
expect(markup).not.toContain("C:/Users/mike/dev-stuff/t3code/apps/web/src/session-logic.ts");
547
});
548
555
- it("renders review comment contexts as structured cards instead of raw tags", async () => {
556
- const { MessagesTimeline } = await import("./MessagesTimeline");
549
+ it("renders review comment contexts as structured cards instead of raw tags", () => {
550
const markup = renderToStaticMarkup(
551
<MessagesTimeline
552
{...buildProps()}
@@ -593,8 +586,7 @@ describe("MessagesTimeline", () => {
586
expect(markup).not.toContain("</review_comment>");
587
});
588
596
- it("renders file review comments as source code instead of diffs", async () => {
597
- const { MessagesTimeline } = await import("./MessagesTimeline");
589
+ it("renders file review comments as source code instead of diffs", () => {
590
const markup = renderToStaticMarkup(
591
<MessagesTimeline
592
{...buildProps()}
@@ -631,8 +623,7 @@ describe("MessagesTimeline", () => {
623
expect(markup).not.toContain('data-testid="file-diff"');
624
});
625
634
- it("renders a failure marker for failed tool lifecycle entries", async () => {
635
- const { MessagesTimeline } = await import("./MessagesTimeline");
626
+ it("renders a failure marker for failed tool lifecycle entries", () => {
627
const markup = renderToStaticMarkup(
628
<MessagesTimeline
629
{...buildProps()}