Skip to content

Commit

Permalink
test: add test that can only be run when there's a document
Browse files Browse the repository at this point in the history
Signed-off-by: Logan McAnsh <logan@mcan.sh>
  • Loading branch information
mcansh committed Nov 30, 2022
1 parent f962790 commit 93c70c4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/form-data/test/form-data.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,28 @@ export const test = (test) => {
assert.equal("blob", file.name);
});

// this will only pass when running `npm run test:web` for this package
test.skip("Allows passing a form element", () => {
const form = document.createElement("form");
const insideInput = document.createElement("input");
const outsideInput = document.createElement("input");

outsideInput.innerHTML = `<input type="text" name="form" value="outside" form="my-form">`;

insideInput.type = "text";
insideInput.name = "form";
insideInput.value = "inside";

form.appendChild(insideInput);
form.id = "my-form";

document.body.appendChild(form);
document.body.appendChild(outsideInput);

const formData = new FormData(form);
assert.equal(formData.getAll("form"), ["inside", "outside"]);
})

test.skip("complicated form", () => {
const data = new FormData();
data.append("blobs", new Blob(["basic"]));
Expand Down

0 comments on commit 93c70c4

Please sign in to comment.