Skip to content

Commit 93c70c4

Browse files
committed
test: add test that can only be run when there's a document
Signed-off-by: Logan McAnsh <logan@mcan.sh>
1 parent f962790 commit 93c70c4

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

packages/form-data/test/form-data.spec.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,28 @@ export const test = (test) => {
239239
assert.equal("blob", file.name);
240240
});
241241

242+
// this will only pass when running `npm run test:web` for this package
243+
test.skip("Allows passing a form element", () => {
244+
const form = document.createElement("form");
245+
const insideInput = document.createElement("input");
246+
const outsideInput = document.createElement("input");
247+
248+
outsideInput.innerHTML = `<input type="text" name="form" value="outside" form="my-form">`;
249+
250+
insideInput.type = "text";
251+
insideInput.name = "form";
252+
insideInput.value = "inside";
253+
254+
form.appendChild(insideInput);
255+
form.id = "my-form";
256+
257+
document.body.appendChild(form);
258+
document.body.appendChild(outsideInput);
259+
260+
const formData = new FormData(form);
261+
assert.equal(formData.getAll("form"), ["inside", "outside"]);
262+
})
263+
242264
test.skip("complicated form", () => {
243265
const data = new FormData();
244266
data.append("blobs", new Blob(["basic"]));

0 commit comments

Comments
 (0)