Phase 2 Refactor MImageBody to MVVM and remove legacy component (#33212)
* MVVMing of MImageBody and removing legacy component + css * Fix Prettier * update small image to large image in test * Update test * Preserve MImageBody legacy class names * Click image in custom component download test * Update snapshots * Update MBodyFactory snapshots * Added new tests to pass coverage * Fix prettier * Remove legacy import that was removed * Add MImageReplayBody test for coverage * Remove legacy MImageBody selectors from image view * Update image body selectors in Playwright tests * Keep file panel image body spacing compact * Update apps/web/src/viewmodels/message-body/ImageBodyViewModel.ts Co-authored-by: Florian Duros <florian.duros@ormaz.fr> * added documentation to component * Fix hidden media placeholder import --------- Co-authored-by: Florian Duros <florian.duros@ormaz.fr>
This commit is contained in:
@@ -105,12 +105,16 @@ test.describe("Custom Component API", () => {
|
||||
});
|
||||
|
||||
await app.timeline.scrollToBottom();
|
||||
const imgTile = page.locator(".mx_MImageBody").first();
|
||||
const imgTile = page.locator(".mx_ImageBody").first();
|
||||
await expect(imgTile).toBeVisible();
|
||||
const image = imgTile.getByRole("img", { name: "bad.png" });
|
||||
await expect(image).toBeVisible();
|
||||
await imgTile.hover();
|
||||
await expect(page.getByRole("button", { name: "Download" })).not.toBeVisible();
|
||||
await imgTile.click();
|
||||
await expect(page.getByLabel("Image view").getByLabel("Download")).not.toBeVisible();
|
||||
await image.click();
|
||||
const imageView = page.getByLabel("Image view");
|
||||
await expect(imageView).toBeVisible();
|
||||
await expect(imageView.getByLabel("Download")).not.toBeVisible();
|
||||
});
|
||||
test("should allow downloading media when the allowDownloading hint is set to true", async ({
|
||||
page,
|
||||
@@ -127,12 +131,16 @@ test.describe("Custom Component API", () => {
|
||||
});
|
||||
|
||||
await app.timeline.scrollToBottom();
|
||||
const imgTile = page.locator(".mx_MImageBody").first();
|
||||
const imgTile = page.locator(".mx_ImageBody").first();
|
||||
await expect(imgTile).toBeVisible();
|
||||
const image = imgTile.getByRole("img", { name: "good.png" });
|
||||
await expect(image).toBeVisible();
|
||||
await imgTile.hover();
|
||||
await expect(page.getByRole("button", { name: "Download" })).toBeVisible();
|
||||
await imgTile.click();
|
||||
await expect(page.getByLabel("Image view").getByLabel("Download")).toBeVisible();
|
||||
await image.click();
|
||||
const imageView = page.getByLabel("Image view");
|
||||
await expect(imageView).toBeVisible();
|
||||
await expect(imageView.getByLabel("Download")).toBeVisible();
|
||||
});
|
||||
test(
|
||||
"should render the next registered component if the filter function throws",
|
||||
|
||||
Reference in New Issue
Block a user