mirror of
https://github.com/maputnik/editor.git
synced 2026-12-04 07:44:22 +00:00
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.
This commit is contained in:
1 parent
c9f44b0cd6
commit
bb1cd631a2
3 files changed
+10
-1
No files matched your search
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in new issue
Block a user