openpencil/packages/core/tests/helpers/scene.ts
Danila Poyarkov 87bff8620c
test(core): move the editor suite into the package (#792)
The 54 editor engine tests move to packages/core/tests/editor with their helpers, importing Core's public subpaths or source modules relatively. The package gains test and typecheck scripts; the first type check fixed nullable lookups, stale imports, and renderer doubles, and graph events now declare the GraphEventRenderer surface they invalidate. The engine baseline drops to 534 files.
2026-09-30 10:22:42 +04:00

20 lines
529 B
TypeScript

import type { SceneGraph, SceneNode } from '@open-pencil/scene-graph'
export function firstPageId(graph: SceneGraph): string {
return graph.getPages()[0].id
}
export function createRect(
graph: SceneGraph,
parentId: string,
props: { name?: string; x?: number; y?: number; width?: number; height?: number } = {}
): SceneNode {
return graph.createNode('RECTANGLE', parentId, {
name: props.name ?? 'Rect',
x: props.x ?? 0,
y: props.y ?? 0,
width: props.width ?? 50,
height: props.height ?? 50
})
}