mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: changing font size when text is not selected or edited (#4751)
Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
parent
e4ffc9812e
commit
d27b3bbebe
3 changed files with 34 additions and 4 deletions
|
@ -1,8 +1,10 @@
|
|||
import { render, waitFor } from "./test-utils";
|
||||
import { queryByTestId, render, waitFor } from "./test-utils";
|
||||
import ExcalidrawApp from "../excalidraw-app";
|
||||
import { API } from "./helpers/api";
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import { EXPORT_DATA_TYPES, MIME_TYPES } from "../constants";
|
||||
import { Pointer, UI } from "./helpers/ui";
|
||||
import { ExcalidrawTextElement } from "../element/types";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
|
@ -48,4 +50,26 @@ describe("appState", () => {
|
|||
expect(h.state.viewBackgroundColor).toBe("#000");
|
||||
});
|
||||
});
|
||||
|
||||
it("changing fontSize with text tool selected (no element created yet)", async () => {
|
||||
const { container } = await render(<ExcalidrawApp />, {
|
||||
localStorageData: {
|
||||
appState: {
|
||||
currentItemFontSize: 30,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
UI.clickTool("text");
|
||||
|
||||
expect(h.state.currentItemFontSize).toBe(30);
|
||||
queryByTestId(container, "fontSize-small")!.click();
|
||||
expect(h.state.currentItemFontSize).toBe(16);
|
||||
|
||||
const mouse = new Pointer("mouse");
|
||||
|
||||
mouse.clickAt(100, 100);
|
||||
|
||||
expect((h.elements[0] as ExcalidrawTextElement).fontSize).toBe(16);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue