Skip to content

Commit c002aca

Browse files
authored
Merge pull request #98 from maxatwork/codex/close-pr-25-regression
test: add checkbox default on regression
2 parents 68a2e94 + 0debb8b commit c002aca

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

packages/dom/test/dom.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,22 @@ describe("formToObject", () => {
135135
});
136136
});
137137

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+
138154
it("does not coerce an empty checked radio option to false when true and false siblings exist", () => {
139155
document.body.innerHTML = `
140156
<form id="testForm">

0 commit comments

Comments
 (0)