mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: Ungroup short cut key (#5779)
* fix: Ungroup short cut key * Add specs
This commit is contained in:
parent
79bd3b8cda
commit
78e254fb30
3 changed files with 648 additions and 1 deletions
|
@ -509,6 +509,51 @@ describe("regression tests", () => {
|
|||
expect(groups.size).toBe(2);
|
||||
});
|
||||
|
||||
it("should group elements and ungroup them", () => {
|
||||
UI.clickTool("rectangle");
|
||||
mouse.down(10, 10);
|
||||
mouse.up(10, 10);
|
||||
|
||||
UI.clickTool("rectangle");
|
||||
mouse.down(10, -10);
|
||||
mouse.up(10, 10);
|
||||
|
||||
UI.clickTool("rectangle");
|
||||
mouse.down(10, -10);
|
||||
mouse.up(10, 10);
|
||||
const end = mouse.getPosition();
|
||||
|
||||
mouse.reset();
|
||||
mouse.down();
|
||||
mouse.restorePosition(...end);
|
||||
mouse.up();
|
||||
|
||||
for (const element of h.elements) {
|
||||
expect(element.groupIds.length).toBe(0);
|
||||
}
|
||||
|
||||
Keyboard.withModifierKeys({ ctrl: true }, () => {
|
||||
Keyboard.keyPress(KEYS.G);
|
||||
});
|
||||
|
||||
for (const element of h.elements) {
|
||||
expect(element.groupIds.length).toBe(1);
|
||||
}
|
||||
|
||||
mouse.reset();
|
||||
mouse.down();
|
||||
mouse.restorePosition(...end);
|
||||
mouse.up();
|
||||
|
||||
Keyboard.withModifierKeys({ ctrl: true, shift: true }, () => {
|
||||
Keyboard.keyPress(KEYS.G);
|
||||
});
|
||||
|
||||
for (const element of h.elements) {
|
||||
expect(element.groupIds.length).toBe(0);
|
||||
}
|
||||
});
|
||||
|
||||
it("double click to edit a group", () => {
|
||||
UI.clickTool("rectangle");
|
||||
mouse.down(10, 10);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue