mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: cmd/ctrl native browser behavior blocked in inputs (#4589)
* fix: cmd/ctrl native browser behavior blocked in inputs * add basic test for fontSize increase/decrease via keyboard * add tests for fontSize resizing via keyboard outside wysiwyg * Update src/element/textWysiwyg.test.tsx Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com> * Update src/tests/resize.test.tsx Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com> * Update src/tests/resize.test.tsx Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com> Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
This commit is contained in:
parent
dba71e358d
commit
1fd2fe56ee
6 changed files with 83 additions and 17 deletions
|
@ -8,7 +8,10 @@ import {
|
|||
getTransformHandles,
|
||||
TransformHandleDirection,
|
||||
} from "../element/transformHandles";
|
||||
import { ExcalidrawElement } from "../element/types";
|
||||
import { ExcalidrawElement, ExcalidrawTextElement } from "../element/types";
|
||||
import ExcalidrawApp from "../excalidraw-app";
|
||||
import { API } from "./helpers/api";
|
||||
import { KEYS } from "../keys";
|
||||
|
||||
const mouse = new Pointer("mouse");
|
||||
|
||||
|
@ -143,3 +146,31 @@ const resize = (
|
|||
mouse.up();
|
||||
});
|
||||
};
|
||||
|
||||
describe("Test text element", () => {
|
||||
it("should update font size via keyboard", async () => {
|
||||
await render(<ExcalidrawApp />);
|
||||
|
||||
const textElement = API.createElement({
|
||||
type: "text",
|
||||
text: "abc",
|
||||
});
|
||||
|
||||
window.h.elements = [textElement];
|
||||
|
||||
API.setSelectedElements([textElement]);
|
||||
|
||||
const origFontSize = textElement.fontSize;
|
||||
|
||||
Keyboard.withModifierKeys({ shift: true, ctrl: true }, () => {
|
||||
Keyboard.keyDown(KEYS.CHEVRON_RIGHT);
|
||||
expect((window.h.elements[0] as ExcalidrawTextElement).fontSize).toBe(
|
||||
origFontSize * 1.1,
|
||||
);
|
||||
Keyboard.keyDown(KEYS.CHEVRON_LEFT);
|
||||
expect((window.h.elements[0] as ExcalidrawTextElement).fontSize).toBe(
|
||||
origFontSize,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue