feat: retain seed on shift-paste (#6509)

thanks for the review 👍
This commit is contained in:
David Luzar
2023-04-24 10:26:21 +02:00
committed by GitHub
parent 9d5cfbbfb7
commit d35386755f
9 changed files with 120 additions and 57 deletions

View File

@ -1,5 +1,10 @@
import ReactDOM from "react-dom";
import { GlobalTestState, render, waitFor } from "./test-utils";
import {
createPasteEvent,
GlobalTestState,
render,
waitFor,
} from "./test-utils";
import { UI, Pointer } from "./helpers/ui";
import { API } from "./helpers/api";
import { actionFlipHorizontal, actionFlipVertical } from "../actions";
@ -680,19 +685,7 @@ describe("freedraw", () => {
describe("image", () => {
const createImage = async () => {
const sendPasteEvent = (file?: File) => {
const clipboardEvent = new Event("paste", {
bubbles: true,
cancelable: true,
composed: true,
});
// set `clipboardData` properties.
// @ts-ignore
clipboardEvent.clipboardData = {
getData: () => window.navigator.clipboard.readText(),
files: [file],
};
const clipboardEvent = createPasteEvent("", file ? [file] : []);
document.dispatchEvent(clipboardEvent);
};