Improve tests

This commit is contained in:
HarelM
2026-07-12 10:43:03 +03:00
parent f2579e2a19
commit 373b57a6f4
2 changed files with 15 additions and 6 deletions
+8 -4
View File
@@ -410,13 +410,17 @@ describe("layer editor", () => {
}); });
}); });
test("should set the property and the default", async () => { test("should set the property", async () => {
// The property is only written to the style on the next change, so these
// two have to be set together.
await when.setFunctionProperty("circle-blur", "myprop"); 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 when.setFunctionDefault("circle-blur", "0.5");
await then(get.styleFromLocalStorage()).shouldDeepNestedInclude({ await then(get.styleFromLocalStorage()).shouldDeepNestedInclude({
layers: [{ id, paint: { "circle-blur": { property: "myprop", default: 0.5 } } }], layers: [{ id, paint: { "circle-blur": { default: 0.5 } } }],
}); });
}); });
+7 -2
View File
@@ -234,10 +234,15 @@ export class MaputnikDriver {
await container.locator("[data-wd-key='function-base'] input").fill(value); 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) => { setFunctionProperty: async (fieldName: string, value: string) => {
const container = this.helper.get.elementByTestId("spec-field-container:" + fieldName); 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. */ /** Sets the fallback value used when a feature has no matching stop. */