mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
parent
ff93d95998
commit
669e84b5d7
2 changed files with 260 additions and 27 deletions
|
@ -665,6 +665,10 @@ describe("regression tests", () => {
|
|||
});
|
||||
// switching to german, `hachure` label should no longer exist
|
||||
expect(screen.queryByText(/hachure/i)).toBeNull();
|
||||
// reset language
|
||||
fireEvent.change(document.querySelector(".dropdown-select__language")!, {
|
||||
target: { value: "en" },
|
||||
});
|
||||
});
|
||||
|
||||
it("make a group and duplicate it", () => {
|
||||
|
@ -847,4 +851,48 @@ describe("regression tests", () => {
|
|||
fireEvent.click(screen.getByText(/code/i));
|
||||
expect(h.state.currentItemFontFamily).toEqual(3); // Cascadia
|
||||
});
|
||||
|
||||
it("shows context menu for canvas", () => {
|
||||
fireEvent.change(document.querySelector(".dropdown-select__language")!, {
|
||||
target: { value: "en" },
|
||||
});
|
||||
fireEvent.contextMenu(canvas, { button: 2, clientX: 1, clientY: 1 });
|
||||
const contextMenu = document.querySelector(".context-menu");
|
||||
const options = contextMenu?.querySelectorAll(".context-menu-option");
|
||||
const expectedOptions = ["Select all"];
|
||||
|
||||
expect(contextMenu).not.toBeNull();
|
||||
expect(options?.length).toBe(1);
|
||||
expect(options?.item(0).textContent).toBe(expectedOptions[0]);
|
||||
});
|
||||
|
||||
it("shows context menu for element", () => {
|
||||
fireEvent.change(document.querySelector(".dropdown-select__language")!, {
|
||||
target: { value: "en" },
|
||||
});
|
||||
clickTool("rectangle");
|
||||
mouse.down(10, 10);
|
||||
mouse.up(20, 20);
|
||||
fireEvent.contextMenu(canvas, { button: 2, clientX: 1, clientY: 1 });
|
||||
const contextMenu = document.querySelector(".context-menu");
|
||||
const options = contextMenu?.querySelectorAll(".context-menu-option");
|
||||
const expectedOptions = [
|
||||
"Copy styles",
|
||||
"Paste styles",
|
||||
"Delete",
|
||||
"Group selection",
|
||||
"Ungroup selection",
|
||||
"Send backward",
|
||||
"Bring forward",
|
||||
"Send to back",
|
||||
"Bring to front",
|
||||
"Duplicate",
|
||||
];
|
||||
|
||||
expect(contextMenu).not.toBeNull();
|
||||
expect(contextMenu?.children.length).toBe(10);
|
||||
options?.forEach((opt, i) => {
|
||||
expect(opt.textContent).toBe(expectedOptions[i]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue