Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/pluggableWidgets/image-web/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- We fixed an issue where an image enlarged on click was shown smaller than the image on the page when its width was a percentage or a maximum height was set. The enlarged image now shows at its natural size, or at its size on the page when that is larger, scaled down to fit the screen.

- We fixed an issue where a height in viewport units was not applied to the image.

## [1.6.1] - 2026-08-14

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ function getStyle(value: string | number, type: WidthUnitEnum | HeightUnitEnum):
return value;
} else if (type === "percentage") {
return value + "%";
} else if (type === "viewport") {
return value + "vh";
}

return "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,24 @@ describe("Image", () => {
expect(image.asFragment()).toMatchSnapshot();
});

it("applies a height in viewport units to the image", () => {
const { getByRole } = render(<Image {...imageProps} height={30} heightUnit="viewport" />);
expect(getByRole("img")).toHaveStyle({ height: "30vh" });
});

it("applies a height in viewport units to the background image", () => {
const { container } = render(
<Image
{...imageProps}
height={30}
heightUnit="viewport"
renderAsBackground
backgroundImageContent={<div>Image content</div>}
/>
);
expect(container.querySelector(".mx-image-background")).toHaveStyle({ height: "30vh" });
});

it("renders the structure with a glyph icon", () => {
const image = render(<Image {...glyphiconProps} />);
expect(image.asFragment()).toMatchSnapshot();
Expand Down
Loading