From bb1cd631a225413c83db14862831f9bcfe022741 Mon Sep 17 00:00:00 2001 From: SHAIK KHADEER BASHA <120262074+KhadeerBasha1232@users.noreply.github.com> Date: Fri, 4 Dec 2026 12:23:47 +0530 Subject: [PATCH] Open icon-padding expressions in the expression editor (#2394) Follow-up to #2391. The earlier change added a numeric list for one to four values. `FieldFunction` still sends every `padding` value to that list, including expressions made by **Convert to expression**. Recognize expression arrays before sending padding values to the number inputs. Numeric arrays and legacy scalar values still use the regular padding editor. Added a Playwright regression check that converts a saved padding value to a literal expression and verifies that the expression editor opens. The existing numeric padding tests also pass. --- CHANGELOG.md | 1 + e2e/layers-list.spec.ts | 8 ++++++++ src/components/FieldFunction.tsx | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97589517..44c7ef6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - _...Add new stuff here..._ ### 🐞 Bug fixes +- Open `icon-padding` expressions in the expression editor so they can be viewed and edited. - Fix `icon-padding` showing four inputs and only saving once all four were filled; it now uses the same add/remove list as other number arrays, up to four values - Make small sprites easier to recognize in the sprite picker with fixed-size previews and high-resolution sprite assets - Prevent a crash when converting a function to an expression diff --git a/e2e/layers-list.spec.ts b/e2e/layers-list.spec.ts index 0455dd8a..21d77f69 100644 --- a/e2e/layers-list.spec.ts +++ b/e2e/layers-list.spec.ts @@ -229,6 +229,14 @@ describe("layers list", () => { await then(get.propertyArrayAddButton("spec-field:icon-padding")).shouldNotExist(); }); + test("should open icon-padding expressions in the expression editor", async () => { + await when.modal.fillLayers({ type: "symbol", layer: "example" }); + await when.setValueToPropertyArray("spec-field:icon-padding", "5"); + await when.makeExpression("icon-padding"); + + await then(get.element("[data-wd-key='spec-field-container:icon-padding'] .cm-content")).shouldContainText('"literal"'); + }); + describe("text-variable-anchor-offset", () => { let id: string; diff --git a/src/components/FieldFunction.tsx b/src/components/FieldFunction.tsx index 55c0bcc5..1a851d27 100644 --- a/src/components/FieldFunction.tsx +++ b/src/components/FieldFunction.tsx @@ -97,7 +97,7 @@ function getDataType(value: any, fieldSpec={} as any) { else if (fieldSpec.type === "colorArray") { return "value"; } - else if (fieldSpec.type === "padding") { + else if (fieldSpec.type === "padding" && (value === null || (Array.isArray(value) && typeof value[0] !== "string"))) { return "value"; } else if (fieldSpec.type === "variableAnchorOffsetCollection" && isVariableAnchorOffsetCollection(value)) {