feat: make clipboard more robust and reintroduce contextmenu actions (#7198)

This commit is contained in:
David Luzar
2023-10-28 21:29:28 +02:00
committed by GitHub
parent ec2de7205f
commit ea677d4581
17 changed files with 611 additions and 193 deletions
-20
View File
@@ -208,26 +208,6 @@ export const assertSelectedElements = (
expect(selectedElementIds).toEqual(expect.arrayContaining(ids));
};
export const createPasteEvent = <T extends "text/plain" | "text/html">(
items: Record<T, string>,
files?: File[],
) => {
return Object.assign(
new Event("paste", {
bubbles: true,
cancelable: true,
composed: true,
}),
{
clipboardData: {
getData: (type: string) =>
(items as Record<string, string>)[type] || "",
files: files || [],
},
},
) as any as ClipboardEvent;
};
export const toggleMenu = (container: HTMLElement) => {
// open menu
fireEvent.click(container.querySelector(".dropdown-menu-button")!);