From 373b57a6f4913fdff155e37a68d1f1aaedd15a8f Mon Sep 17 00:00:00 2001 From: HarelM Date: Sun, 12 Jul 2026 10:43:03 +0300 Subject: [PATCH] Improve tests --- e2e/layer-editor.spec.ts | 12 ++++++++---- e2e/maputnik-driver.ts | 9 +++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/e2e/layer-editor.spec.ts b/e2e/layer-editor.spec.ts index e5d2ef93..95a16ba4 100644 --- a/e2e/layer-editor.spec.ts +++ b/e2e/layer-editor.spec.ts @@ -410,13 +410,17 @@ describe("layer editor", () => { }); }); - test("should set the property and the default", async () => { - // The property is only written to the style on the next change, so these - // two have to be set together. + test("should set the property", async () => { await when.setFunctionProperty("circle-blur", "myprop"); + await then(get.styleFromLocalStorage()).shouldDeepNestedInclude({ + layers: [{ id, paint: { "circle-blur": { property: "myprop" } } }], + }); + }); + + test("should set the default", async () => { await when.setFunctionDefault("circle-blur", "0.5"); await then(get.styleFromLocalStorage()).shouldDeepNestedInclude({ - layers: [{ id, paint: { "circle-blur": { property: "myprop", default: 0.5 } } }], + layers: [{ id, paint: { "circle-blur": { default: 0.5 } } }], }); }); diff --git a/e2e/maputnik-driver.ts b/e2e/maputnik-driver.ts index b82ff9f7..2f7cd6d6 100644 --- a/e2e/maputnik-driver.ts +++ b/e2e/maputnik-driver.ts @@ -234,10 +234,15 @@ export class MaputnikDriver { await container.locator("[data-wd-key='function-base'] input").fill(value); }, - /** Sets the data property a data function keys off of. */ + /** + * Sets the data property a data function keys off of. This is an InputString, + * which only commits its value on blur, so typing alone is not enough. + */ setFunctionProperty: async (fieldName: string, value: string) => { const container = this.helper.get.elementByTestId("spec-field-container:" + fieldName); - await container.locator("[data-wd-key='function-property'] input").fill(value); + const input = container.locator("[data-wd-key='function-property'] input"); + await input.fill(value); + await input.blur(); }, /** Sets the fallback value used when a feature has no matching stop. */