feat: dark mode by default
This commit is contained in:
@@ -20,6 +20,15 @@ function withApi() {
|
||||
}
|
||||
|
||||
describe("api", () => {
|
||||
test("creates a drawing with dark theme by default", async () => {
|
||||
const { api, cleanup } = withApi();
|
||||
|
||||
const created = await api.createDrawing().json();
|
||||
|
||||
expect(created.appState.theme).toBe("dark");
|
||||
cleanup();
|
||||
});
|
||||
|
||||
test("returns 400 for invalid JSON", async () => {
|
||||
const { api, cleanup } = withApi();
|
||||
const drawing = await api.createDrawing().json();
|
||||
|
||||
@@ -27,6 +27,7 @@ describe("drawing store", () => {
|
||||
const created = store.createDrawing();
|
||||
|
||||
expect(created.title).toBe("Untitled");
|
||||
expect(created.scene.appState.theme).toBe("dark");
|
||||
expect(store.listDrawings()).toHaveLength(1);
|
||||
|
||||
const updated = store.updateDrawing(created.id, {
|
||||
|
||||
+7
-1
@@ -1,7 +1,13 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { HttpError, MAX_SCENE_BYTES, normalizeScene, parseJsonBody } from "./scene";
|
||||
import { HttpError, MAX_SCENE_BYTES, emptyScene, normalizeScene, parseJsonBody } from "./scene";
|
||||
|
||||
describe("scene helpers", () => {
|
||||
test("creates empty scenes with dark theme by default", () => {
|
||||
const scene = emptyScene();
|
||||
|
||||
expect(scene.appState.theme).toBe("dark");
|
||||
});
|
||||
|
||||
test("normalizes volatile app state fields", () => {
|
||||
const scene = normalizeScene({
|
||||
elements: [],
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ const VOLATILE_APP_STATE_KEYS = new Set([
|
||||
export function emptyScene(): ScenePayload {
|
||||
return {
|
||||
elements: [],
|
||||
appState: {},
|
||||
appState: { theme: "dark" },
|
||||
files: {},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user