feat(commands): add artboard bounds command

This commit is contained in:
syntaxbullet
2026-07-03 16:05:15 +02:00
parent 4d77288450
commit e90b829e62
4 changed files with 37 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
import { describe, expect, test } from "bun:test";
import { createInitialAppState } from "@editor/initial-state";
import { documentAddArtboardCommand } from "./document";
import { documentAddArtboardCommand, documentSetArtboardBoundsCommand } from "./document";
describe("document commands", () => {
test("adds transparent artboard", () => {
@@ -19,4 +19,15 @@ describe("document commands", () => {
},
]);
});
test("sets artboard bounds", () => {
const state = documentAddArtboardCommand.execute(
{ state: createInitialAppState("Test") },
{ id: "a1", name: "Artboard 1", bounds: { x: 0, y: 0, w: 320, h: 240 } },
);
const next = documentSetArtboardBoundsCommand.execute({ state }, { id: "a1", bounds: { x: 10, y: 20, w: 640, h: 480 } });
expect(next.document.artboards[0]?.bounds).toEqual({ x: 10, y: 20, w: 640, h: 480 });
});
});