Skip to content

Commit b1b4601

Browse files
committed
maint(core dom): Add test to prove that jsDOM supports input elements outside forms.
1 parent 3630a86 commit b1b4601

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/core/dom.test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,24 @@ describe("core.dom tests", () => {
1010
jest.restoreAllMocks();
1111
});
1212

13+
describe("jsDOM tests", () => {
14+
it("jsDOM supports input elements outside forms.", () => {
15+
document.body.innerHTML = `
16+
<input name="outside" form="a_form"/>
17+
<form id="a_form">
18+
<input name="inside"/>
19+
</form>
20+
`;
21+
22+
const outside = document.querySelector("input[name=outside]");
23+
const inside = document.querySelector("input[name=inside]");
24+
const form = document.querySelector("form");
25+
26+
expect(outside.form).toBe(form);
27+
expect(inside.form).toBe(form);
28+
});
29+
});
30+
1331
describe("document_ready", () => {
1432
it("calls the callback, once the document is ready.", async () => {
1533
let cnt = 0;

0 commit comments

Comments
 (0)