fix(files): a row's picture fits its box on iPad

In a table cell WebKit resolved the picture's h-full against the aspect-video box as the poster's own height, so the box showed a native-size sliver of it. The box now has a fixed 16:9 height, as the other pictures in tables do; an e2e check runs in the WebKit and iPad projects.
This commit is contained in:
2026-11-14 21:34:33 +01:00
parent 903e56fba5
commit 06c0ab5fb6
2 changed files with 50 additions and 1 deletions
+46
View File
@@ -24,6 +24,52 @@ test.describe("Files", () => {
await expect(dialog(page)).toBeHidden();
});
// WebKit (every iPad browser) cannot resolve a percentage height against a box whose height comes
// from aspect-ratio inside a table cell: the picture took its own full height and the 16:9 box
// showed a native-size sliver of it, a blur of colour. The library is stubbed with one file whose
// poster is a tall picture, the case that shows it most.
test("a row's picture fits its box", async ({ page }) => {
const file = {
id: 990001,
status: "done",
progress: 100,
created_at: "2026-11-14T10:00:00+00:00",
source_kind: "youtube",
source_ref: "e2e-thumb",
source_url: null,
poster_url: "/api/downloads/990001/poster.jpg",
display_name: "A tall poster",
display_uploader: null,
extra_links: [],
can_download: true,
job_kind: "download",
folder_id: null,
kept: false,
expires_at: null,
shared: false,
source_key: "youtube",
asset: { media_kind: "video", duration_s: 60, size_bytes: 2048 },
};
await page.route(/\/api\/files(\?|$)/, (route) => route.fulfill({ json: [file] }));
await page.route(/\/api\/downloads\/990001\/poster\.jpg/, (route) =>
route.fulfill({
contentType: "image/svg+xml",
body: '<svg xmlns="http://www.w3.org/2000/svg" width="1080" height="1920"><rect width="1080" height="1920" fill="#3a6"/></svg>',
}),
);
// Wide enough that the picture column shows beside a pinned rail (an iPad Pro in landscape).
await page.setViewportSize({ width: 1366, height: 1024 });
await openApp(page);
await gotoPage(page, "files");
const picture = page.getByRole("row", { name: /A tall poster/ }).locator("img");
await expect(picture).toBeVisible();
const fit = await picture.evaluate((img) => {
const box = img.parentElement!.getBoundingClientRect();
return { img: img.getBoundingClientRect().height, box: box.height };
});
expect(fit.img).toBeLessThanOrEqual(fit.box);
});
test("a link pasted onto a page (not into a field) opens the download dialog", async ({
page,
}) => {