We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 68a2e94 + 0debb8b commit c002acaCopy full SHA for c002aca
1 file changed
packages/dom/test/dom.test.ts
@@ -135,6 +135,22 @@ describe("formToObject", () => {
135
});
136
137
138
+ it("uses the browser default on value for checked checkboxes without an explicit value", () => {
139
+ document.body.innerHTML = `
140
+ <form id="testForm">
141
+ <input type="checkbox" name="enabled" checked />
142
+ <input type="checkbox" name="disabled" />
143
+ </form>
144
+ `;
145
+
146
+ const form = document.getElementById("testForm") as HTMLFormElement;
147
148
+ expect(extractPairs(form)).toEqual([{ key: "enabled", value: "on" }]);
149
+ expect(formToObject(form)).toEqual({
150
+ enabled: "on"
151
+ });
152
153
154
it("does not coerce an empty checked radio option to false when true and false siblings exist", () => {
155
document.body.innerHTML = `
156
<form id="testForm">
0 commit comments