feat(training): captions under lesson images

Authors can now attach a caption to an image in the lesson editor; it is
sanitized as figure text and follows the image's alignment in the reader.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
2026-11-21 00:45:32 +00:00
parent f7a0c8618f
commit 8601a6014f
6 changed files with 130 additions and 11 deletions
+6
View File
@@ -91,11 +91,16 @@ test.describe("training", () => {
await page
.getByRole("button", { name: "Set image width to 50%" })
.click();
page.once("dialog", (dialog) => dialog.accept("Front-of-house console"));
await page.getByRole("button", { name: "Add image caption" }).click();
await page.getByRole("button", { name: "Save lesson" }).click();
await expect(
lesson.locator('img[data-align="right"][width="50%"]'),
).toBeVisible();
await expect(lesson.locator("figcaption")).toHaveText(
"Front-of-house console",
);
const pdf = Buffer.from("%PDF-1.7\n% E2E manual\n");
await lesson
@@ -127,6 +132,7 @@ test.describe("training", () => {
).toHaveCount(0);
await expect(page.getByRole("link", { name: "guide.txt" })).toBeVisible();
await expect(page.getByRole("img", { name: "console.png" })).toBeVisible();
await expect(page.getByText("Front-of-house console")).toBeVisible();
await expect(
page.getByRole("link", { name: "audio-manual.pdf" }),
).toBeVisible();