release: WRNexusJS 0.3.5

This commit is contained in:
2026-07-24 12:46:44 +05:30
parent 44ba847210
commit c81dedff17
2114 changed files with 65790 additions and 150559 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/validation",
"version": "0.3.4",
"version": "0.3.5",
"private": true,
"type": "module",
"main": "src/index.ts",
+4
View File
@@ -150,6 +150,10 @@ export const VALIDATE_RUNTIME = String.raw`
var name = form.getAttribute("data-schema");
var schema = (window.__wireSchemas || {})[name];
if (!schema) return;
// Schema-backed forms use WRNexus messages instead of the browser's
// non-themeable native validation bubbles.
form.noValidate = true;
form.setAttribute("novalidate", "");
form.addEventListener("submit", function (e) {
e.preventDefault();
if (validateForm(form, schema) > 0) return; // client-invalid: stay put, errors shown
@@ -68,8 +68,11 @@ test("browser validation displays the serialized custom required message", () =>
(0, eval)(VALIDATE_RUNTIME);
const runtime = win.__wireValidate as { init(root: Document): void };
runtime.init(win.document as unknown as Document);
const form = win.document.querySelector("form")!;
win.document.querySelector("input")!.dispatchEvent(new win.Event("blur", { bubbles: true }));
expect(form.noValidate).toBe(true);
expect(form.hasAttribute("novalidate")).toBe(true);
expect(win.document.querySelector("[data-error=email]")!.textContent).toBe(
"Enter your email or username",
);