ITADN

fix: allow decimal inputs for number fields

#431Pull Requestfetwar 创建于 2025-10-31
F
fetwarcommented
Fixes #430 (original issue #186). I attempted to add a regression test within `formEngine.test.ts`, however the step is an actual HTML input prop, not part of the formEngine validation. Testing of HTML inputs in this way would require Svelte component testing or higher level e2e testing which doesn't seem to be set up, if I missed it please let me know. For reference this test passes with current code (bugged): ```ts it("should accept decimal numbers for number fields", () => { const onSubmitMock = jest.fn(); const formEngine = makeFormEngine({ onSubmit: onSubmitMock, onCancel: console.log, }); const numberField = formEngine.addField({ name: "decimalField" }); numberField.value.set(1.5); formEngine.triggerSubmit(); expect(onSubmitMock).toHaveBeenCalledWith({ decimalField: 1.5, }); expect(get(formEngine.isValid)).toBe(true); expect(get(numberField.errors)).toStrictEqual([]); }); ```
合并状态:未合并 关闭于 2025-11-20 2 条评论