Skip to content

Commit 5eb0bd8

Browse files
fix(ui): keep Review file previews within panel
1 parent 8a2f6c3 commit 5eb0bd8

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

‎ui/src/pages/chat/components/chat-sidebar-file-view.browser.test.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,24 @@ afterEach(() => {
7272
});
7373

7474
describe.runIf(browserMode)("chat file editor", () => {
75+
it("keeps long lines inside Review and gives horizontal scroll to the editor", async () => {
76+
const panel = await mountFile({
77+
kind: "file",
78+
path: "src/long-line.ts",
79+
name: "long-line.ts",
80+
content: `export const value = "${"long-content-".repeat(80)}";`,
81+
});
82+
panel.style.width = "320px";
83+
84+
const fileView = panel.querySelector<HTMLElement>(".file-view")!;
85+
const scroller = panel.querySelector<HTMLElement>(".cm-scroller")!;
86+
await expect.poll(() => fileView.clientWidth).toBeGreaterThan(0);
87+
expect(fileView.clientWidth).toBeLessThanOrEqual(panel.clientWidth);
88+
expect(fileView.scrollWidth).toBe(fileView.clientWidth);
89+
expect(scroller.scrollWidth).toBeGreaterThan(scroller.clientWidth);
90+
expect(getComputedStyle(scroller).overflowX).toBe("auto");
91+
});
92+
7593
it("renders content and decorates the requested line", async () => {
7694
const panel = await mountFile({
7795
kind: "file",

‎ui/src/styles/chat/sidebar.css‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,6 +1564,7 @@ openclaw-chat-sidebar-region,
15641564
display: flex;
15651565
flex: 1;
15661566
flex-direction: column;
1567+
min-width: 0;
15671568
min-height: 0;
15681569
}
15691570

0 commit comments

Comments
 (0)