perf(webui): reduce file activity layout work (#6587)

This commit is contained in:
chengyongru authored and GitHub committed 2026-11-06 23:21:48 +08:00
1 parent 3404fe83e2
commit 94bfd3ff7d
6 files changed
+98 -17

No files matched your search

+7 -2
View File
@@ -48,8 +48,7 @@ for (const width of [360, 1024]) {
await longPath.press("Enter");
await expect(page.getByLabel("Opened file")).toHaveText(longEditPath);
await expect(hint).toBeHidden();
await page.getByRole("button", { name: /View changes/ }).first().click();
await expect(page.getByTestId("file-edit-diff")).toBeVisible();
// Check hover before expanding the diff above it, which moves the image row.
const imagePath = references.nth(3);
await expect(imagePath).toContainText("…");
await imagePath.hover();
@@ -62,9 +61,15 @@ for (const width of [360, 1024]) {
await page.mouse.move(0, 0);
await imagePath.focus();
await expect(hint).toContainText(longEditPath.replace("serve_fixture.py", "screenshot.png"));
await page.getByRole("button", { name: /View changes/ }).first().click();
await expect(page.getByTestId("file-edit-diff")).toBeVisible();
await page.setViewportSize({ width: 1600, height: 800 });
await page.getByLabel("File edits").evaluate((element) => { (element as HTMLElement).style.maxWidth = "none"; });
await expect(longPath).not.toContainText("…");
expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true);
await page.setViewportSize({ width, height: 800 });
await page.getByLabel("File edits").evaluate((element) => { (element as HTMLElement).style.maxWidth = "640px"; });
await expect(longPath).toContainText("…");
await expect(references.nth(1)).not.toContainText("…");
});
}