Skip to content
Open
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
4 changes: 4 additions & 0 deletions packages/pluggableWidgets/image-web/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Changed

- We changed the default maximum height to 250 pixels for new Image widgets. Existing widgets are not affected.

### Fixed

- We fixed an issue where previews in Design and Structure modes did not respect the configured minimum and maximum image height.
Expand Down
24 changes: 15 additions & 9 deletions packages/pluggableWidgets/image-web/e2e/onClick.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,42 @@ test.describe("Image viewer", () => {
const dynamicImage =
"https://www.learningcontainer.com/wp-content/uploads/2020/08/Sample-png-Image-for-Testing.png";

const imageButton = (page, widgetClass) => page.locator(`${widgetClass} [role='button']`);

test("triggers a Microflow on click", async ({ page }) => {
await page.goto("/p/onClickMicroflow");
await waitForMendixApp(page);
await page.click(".mx-name-image1");
const modalDialog = await page.locator(".modal-dialog");
await imageButton(page, ".mx-name-image1").click();
const modalDialog = page.locator(".modal-dialog");
await expect(modalDialog).toBeVisible();
await expect(modalDialog).toContainText("You clicked this image");
});

test("triggers a Nanoflow on click", async ({ page }) => {
await page.goto("/p/onClickNanoflow");
await waitForMendixApp(page);
await page.click(".mx-name-image1");
const modalDialog = await page.locator(".modal-dialog");
await imageButton(page, ".mx-name-image1").click();
const modalDialog = page.locator(".modal-dialog");
await expect(modalDialog).toBeVisible();
await expect(modalDialog).toContainText(dynamicImage);
});

test("opens a Page on click", async ({ page }) => {
await page.goto("/p/onClickShowPage");
await waitForMendixApp(page);
await page.click(".mx-name-image1");
const modalDialog = await page.locator(".modal-dialog");
const caption = await modalDialog.locator("#mxui_widget_Window_0_caption");
await imageButton(page, ".mx-name-image1").click();
const modalDialog = page.locator(".modal-dialog");
await expect(modalDialog).toBeVisible();
const caption = modalDialog.locator("#mxui_widget_Window_0_caption");
await expect(caption).toContainText("GazaLand");
});

test("shows full screen image on click", async ({ page }) => {
await page.goto("/p/onClickOpenFullScreen");
await waitForMendixApp(page);
await page.click(".mx-name-imageRender1");
const lightboxImage = await page.locator(".mx-image-viewer-lightbox img");
await imageButton(page, ".mx-name-imageRender1").click();
const lightboxImage = page.locator(".mx-image-viewer-lightbox img");
await expect(lightboxImage).toBeVisible();
await expect(lightboxImage).toHaveAttribute("src", /ImageViewer\$Images\$landscape_2\.png/);
});
});
4 changes: 2 additions & 2 deletions packages/pluggableWidgets/image-web/src/Image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
<caption>Minimum height</caption>
<description />
</property>
<property key="maxHeightUnit" type="enumeration" defaultValue="none">
<property key="maxHeightUnit" type="enumeration" defaultValue="pixels">
<caption>Maximum Height unit</caption>
<description />
<enumerationValues>
Expand All @@ -120,7 +120,7 @@
<enumerationValue key="viewport">Viewport</enumerationValue>
</enumerationValues>
</property>
<property key="maxHeight" type="integer" required="true" defaultValue="0">
<property key="maxHeight" type="integer" required="true" defaultValue="250">
<caption>Maximum height</caption>
<description />
</property>
Expand Down
Loading