openpencil/tests/engine/layout/auto-layout/vertical/basic.test.ts
Danila Poyarkov aad26b535e test: move prefixed splits into domain folders
- Move newly split tests under explicit domain subfolders
- Update nested helper imports after the moves
- Add a lint guard against repeating existing sibling domains as filename prefixes
2026-05-06 14:27:21 +03:00

47 lines
1.2 KiB
TypeScript

import { describe, expect, test } from 'bun:test'
import { computeLayout, SceneGraph } from '@open-pencil/core'
import { autoFrame, pageId, rect } from '#tests/helpers/layout'
describe('vertical basic', () => {
test('positions children top-to-bottom', () => {
const graph = new SceneGraph()
const frame = autoFrame(graph, pageId(graph), {
layoutMode: 'VERTICAL',
width: 200,
height: 400
})
rect(graph, frame.id, 50, 80)
rect(graph, frame.id, 50, 60)
rect(graph, frame.id, 50, 100)
computeLayout(graph, frame.id)
const children = graph.getChildren(frame.id)
expect(children[0].y).toBe(0)
expect(children[1].y).toBe(80)
expect(children[2].y).toBe(140)
})
test('applies item spacing vertically', () => {
const graph = new SceneGraph()
const frame = autoFrame(graph, pageId(graph), {
layoutMode: 'VERTICAL',
width: 200,
height: 400,
itemSpacing: 16
})
rect(graph, frame.id, 50, 40)
rect(graph, frame.id, 50, 40)
rect(graph, frame.id, 50, 40)
computeLayout(graph, frame.id)
const children = graph.getChildren(frame.id)
expect(children[0].y).toBe(0)
expect(children[1].y).toBe(56)
expect(children[2].y).toBe(112)
})
})