Skip to content

Commit 84771a9

Browse files
rahmanunvergjulivan
authored andcommitted
test(checkbox-radio-selection-web): update e2e test with new naming
1 parent f10cdb1 commit 84771a9

File tree

3 files changed

+28
-34
lines changed

3 files changed

+28
-34
lines changed

packages/pluggableWidgets/checkbox-radio-selection-web/e2e/SelectionControls.spec.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,46 @@ test.afterEach("Cleanup session", async ({ page }) => {
55
await page.evaluate(() => window.mx.session.logout());
66
});
77

8-
test.describe("selection-controls-web", () => {
8+
test.describe("checkbox-radio-selection-web", () => {
99
test.beforeEach(async ({ page }) => {
10-
await page.goto("/p/selectioncontrols");
10+
await page.goto("p/CheckboxRadioSelection");
1111
await page.waitForLoadState("networkidle");
1212
});
1313

1414
test.describe("data source types", () => {
15-
test("renders selection controls using association", async ({ page }) => {
16-
const selectionControls = page.locator(".mx-name-selectionControls1");
15+
test("renders checkbox radio selection using association", async ({ page }) => {
16+
const selectionControls = page.locator(".mx-name-checkboxRadioSelection1");
1717
await expect(selectionControls).toBeVisible({ timeout: 10000 });
18-
await expect(selectionControls).toHaveScreenshot(`selectionControlsAssociation.png`);
18+
await expect(selectionControls).toHaveScreenshot(`checkboxRadioSelectionAssociation.png`);
1919
});
2020

21-
test("renders selection controls using enum", async ({ page }) => {
22-
const selectionControls = page.locator(".mx-name-selectionControls2");
21+
test("renders checkbox radio selection using enum", async ({ page }) => {
22+
const selectionControls = page.locator(".mx-name-checkboxRadioSelection2");
2323
await expect(selectionControls).toBeVisible({ timeout: 10000 });
24-
await expect(selectionControls).toHaveScreenshot(`selectionControlsEnum.png`);
24+
await expect(selectionControls).toHaveScreenshot(`checkboxRadioSelectionEnum.png`);
2525
});
2626

27-
test("renders selection controls using boolean", async ({ page }) => {
28-
const selectionControls = page.locator(".mx-name-selectionControls3");
27+
test("renders checkbox radio selection using boolean", async ({ page }) => {
28+
const selectionControls = page.locator(".mx-name-checkboxRadioSelection3");
2929
await expect(selectionControls).toBeVisible({ timeout: 10000 });
30-
await expect(selectionControls).toHaveScreenshot(`selectionControlsBoolean.png`);
30+
await expect(selectionControls).toHaveScreenshot(`checkboxRadioSelectionBoolean.png`);
3131
});
3232

33-
test("renders selection controls using static values", async ({ page }) => {
34-
const selectionControls = page.locator(".mx-name-selectionControls4");
33+
test("renders checkbox radio selection using static values", async ({ page }) => {
34+
const selectionControls = page.locator(".mx-name-checkboxRadioSelection4");
3535
await expect(selectionControls).toBeVisible({ timeout: 10000 });
36-
await expect(selectionControls).toHaveScreenshot(`selectionControlsStatic.png`);
36+
await expect(selectionControls).toHaveScreenshot(`checkboxRadioSelectionStatic.png`);
3737
});
3838

39-
test("renders selection controls using database", async ({ page }) => {
40-
const selectionControls = page.locator(".mx-name-selectionControls5");
39+
test("renders checkbox radio selection using database", async ({ page }) => {
40+
const selectionControls = page.locator(".mx-name-checkboxRadioSelection5");
4141
await expect(selectionControls).toBeVisible({ timeout: 10000 });
42-
await expect(selectionControls).toHaveScreenshot(`selectionControlsDatabase.png`);
42+
await expect(selectionControls).toHaveScreenshot(`checkboxRadioSelectionDatabase.png`);
4343
});
4444

4545
test.describe("selection behavior", () => {
4646
test("handles radio button selection", async ({ page }) => {
47-
const selectionControls = page.locator(".mx-name-selectionControls1");
47+
const selectionControls = page.locator(".mx-name-checkboxRadioSelection1");
4848
await expect(selectionControls).toBeVisible({ timeout: 10000 });
4949

5050
const radioOption = selectionControls.locator('input[type="radio"]').first();
@@ -53,7 +53,7 @@ test.describe("selection-controls-web", () => {
5353
});
5454

5555
test("handles checkbox selection", async ({ page }) => {
56-
const selectionControls = page.locator(".mx-name-selectionControls6"); // multi selection
56+
const selectionControls = page.locator(".mx-name-checkboxRadioSelection6"); // multi selection
5757
await expect(selectionControls).toBeVisible({ timeout: 10000 });
5858

5959
const checkboxOption = selectionControls.locator('input[type="checkbox"]').first();

packages/pluggableWidgets/checkbox-radio-selection-web/src/CheckboxRadioSelection.editorConfig.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import {
66
dropzone,
77
container,
88
rowLayout,
9-
text,
10-
svgImage
9+
text
1110
} from "@mendix/widget-plugin-platform/preview/structure-preview-api";
1211
import { CheckboxRadioSelectionPreviewProps } from "../typings/CheckboxRadioSelectionProps";
1312
import { getCustomCaption } from "./helpers/utils";
@@ -134,14 +133,14 @@ export function getProperties(
134133
}
135134

136135
function getIconPreview(isMultiSelect: boolean): ContainerProps {
137-
return container({ grow: 0 })(
138-
container({ padding: 3 })(),
139-
svgImage({ width: 16, height: 16, grow: 0 })(
140-
decodeURIComponent(
141-
(isMultiSelect ? IconCheckboxSVG : IconRadioButtonSVG).replace("data:image/svg+xml,", "")
142-
)
143-
)
144-
);
136+
return container({ grow: 0 })(container({ padding: 3 })(), {
137+
type: "Image",
138+
document: decodeURIComponent(
139+
(isMultiSelect ? IconCheckboxSVG : IconRadioButtonSVG).replace("data:image/svg+xml,", "")
140+
),
141+
width: 16,
142+
height: 16
143+
});
145144
}
146145

147146
export function getPreview(values: CheckboxRadioSelectionPreviewProps, isDarkMode: boolean): StructurePreviewProps {
@@ -189,11 +188,6 @@ export function getPreview(values: CheckboxRadioSelectionPreviewProps, isDarkMod
189188
}
190189
}
191190

192-
// Handle database-specific read-only logic
193-
// if (values.source === "database" && values.databaseAttributeString.length === 0) {
194-
// readOnly = values.customEditability === "never";
195-
// }
196-
197191
// If no custom content dropzones, show default preview
198192
if (structurePreviewChildren.length === 0) {
199193
const isMultiSelect = values.optionsSourceDatabaseItemSelection === "Multi";

0 commit comments

Comments
 (0)