'],
])("leaves text dropped into %s to the webview", (_, html) => {
const field = element(html);
const types = ["text/plain"];
expect(drag("dragover", field, types)).toEqual({
prevented: false,
dropEffect: "copy",
});
expect(drag("drop", field, types).prevented).toBe(false);
});
test("refuses text dropped on an element that isn't editable", () => {
const field = element('
x
');
expect(drag("drop", field, ["text/plain"]).prevented).toBe(true);
});
test("refuses a file over a field that didn't accept it", () => {
const field = element("");
expect(drag("dragover", field, ["Files"])).toEqual({
prevented: true,
dropEffect: "none",
});
});
test("keeps the drop effect of a field that accepted the file", () => {
const field = element("");
field.addEventListener("dragover", event => event.preventDefault());
expect(drag("dragover", field, ["Files"])).toEqual({
prevented: true,
dropEffect: "copy",
});
});
});