mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: default light theme splash 🔧 (#5660)
Co-authored-by: dwelle <luzar.david@gmail.com> Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
This commit is contained in:
parent
ec4b3d913e
commit
7eaf47c9d4
16 changed files with 97 additions and 52 deletions
|
@ -88,21 +88,42 @@ describe("<Excalidraw/>", () => {
|
|||
});
|
||||
|
||||
describe("Test theme prop", () => {
|
||||
it('should show the dark mode toggle when the theme prop is "undefined"', async () => {
|
||||
it("should show the theme toggle by default", async () => {
|
||||
const { container } = await render(<Excalidraw />);
|
||||
expect(h.state.theme).toBe(THEME.LIGHT);
|
||||
|
||||
const darkModeToggle = queryByTestId(container, "toggle-dark-mode");
|
||||
|
||||
expect(darkModeToggle).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should not show the dark mode toggle when the theme prop is not "undefined"', async () => {
|
||||
it("should not show theme toggle when the theme prop is defined", async () => {
|
||||
const { container } = await render(<Excalidraw theme="dark" />);
|
||||
expect(h.state.theme).toBe(THEME.DARK);
|
||||
|
||||
expect(queryByTestId(container, "toggle-dark-mode")).toBe(null);
|
||||
});
|
||||
|
||||
it("should show theme mode toggle when `UIOptions.canvasActions.toggleTheme` is true", async () => {
|
||||
const { container } = await render(
|
||||
<Excalidraw
|
||||
theme={THEME.DARK}
|
||||
UIOptions={{ canvasActions: { toggleTheme: true } }}
|
||||
/>,
|
||||
);
|
||||
expect(h.state.theme).toBe(THEME.DARK);
|
||||
const darkModeToggle = queryByTestId(container, "toggle-dark-mode");
|
||||
expect(darkModeToggle).toBeTruthy();
|
||||
});
|
||||
|
||||
it("should not show theme toggle when `UIOptions.canvasActions.toggleTheme` is false", async () => {
|
||||
const { container } = await render(
|
||||
<Excalidraw
|
||||
UIOptions={{ canvasActions: { toggleTheme: false } }}
|
||||
theme={THEME.DARK}
|
||||
/>,
|
||||
);
|
||||
expect(h.state.theme).toBe(THEME.DARK);
|
||||
const darkModeToggle = queryByTestId(container, "toggle-dark-mode");
|
||||
expect(darkModeToggle).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Test name prop", () => {
|
||||
|
@ -214,7 +235,7 @@ describe("<Excalidraw/>", () => {
|
|||
|
||||
it("should hide the theme toggle when theme is false", async () => {
|
||||
const { container } = await render(
|
||||
<Excalidraw UIOptions={{ canvasActions: { theme: false } }} />,
|
||||
<Excalidraw UIOptions={{ canvasActions: { toggleTheme: false } }} />,
|
||||
);
|
||||
|
||||
expect(queryByTestId(container, "toggle-dark-mode")).toBeNull();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue