mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: Export THEME from the package (#4055)
* Use Theme type everywhere * Rename Appearance type to Theme for consistency * Reorder headers in readme The host don't need to pass hardcoded strings any more and instead can use the exported constant
This commit is contained in:
parent
be2da9539e
commit
463857ad9a
15 changed files with 582 additions and 559 deletions
|
@ -2,7 +2,7 @@ import React from "react";
|
|||
import { fireEvent, GlobalTestState, render } from "../test-utils";
|
||||
import Excalidraw from "../../packages/excalidraw/index";
|
||||
import { queryByText, queryByTestId } from "@testing-library/react";
|
||||
import { GRID_SIZE } from "../../constants";
|
||||
import { GRID_SIZE, THEME } from "../../constants";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
const { h } = window;
|
||||
|
@ -91,7 +91,7 @@ describe("<Excalidraw/>", () => {
|
|||
describe("Test theme prop", () => {
|
||||
it('should show the dark mode toggle when the theme prop is "undefined"', async () => {
|
||||
const { container } = await render(<Excalidraw />);
|
||||
expect(h.state.theme).toBe("light");
|
||||
expect(h.state.theme).toBe(THEME.LIGHT);
|
||||
|
||||
const darkModeToggle = queryByTestId(container, "toggle-dark-mode");
|
||||
|
||||
|
@ -100,7 +100,7 @@ describe("<Excalidraw/>", () => {
|
|||
|
||||
it('should not show the dark mode toggle when the theme prop is not "undefined"', async () => {
|
||||
const { container } = await render(<Excalidraw theme="dark" />);
|
||||
expect(h.state.theme).toBe("dark");
|
||||
expect(h.state.theme).toBe(THEME.DARK);
|
||||
|
||||
expect(queryByTestId(container, "toggle-dark-mode")).toBe(null);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue