Skip to content

Commit

Permalink
schematic path support
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed Mar 27, 2024
1 parent 06a34f8 commit 314d99c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 30 deletions.
Expand Up @@ -13,11 +13,13 @@ import {
SchematicTextBuilder,
createSchematicTextBuilder,
} from "./schematic-text-builder"
import { createSchematicPathBuilder } from "./schematic-path-builder"

const schematic_symbol_addables = {
schematic_box: createSchematicBoxBuilder,
schematic_line: createSchematicLineBuilder,
schematic_text: createSchematicTextBuilder,
schematic_path: createSchematicPathBuilder,
}

type SchematicSymbolAddables = typeof schematic_symbol_addables
Expand Down
45 changes: 15 additions & 30 deletions tests/primitives/schematic-path.test.ts
Expand Up @@ -2,37 +2,22 @@ import test from "ava"
import { createProjectBuilder } from "lib/builder"
import { logLayout } from "../utils/log-layout"

// test("render a schematic with text", async (t) => {
// const pb = createProjectBuilder()

// const soup = await pb
// .add("component", (cb) =>
// cb.modifySchematic((scb) =>
// scb.add("schematic_text", (st) =>
// st.setProps({
// position: { x: 0, y: 0 },
// text: "Hello, World!",
// })
// )
// )
// )
// .build()

// await logLayout("custom schematic symbol with text", soup)
// t.pass()
// })

test("render a simple schematic path", async (t) => {
const soup = await createProjectBuilder().add("component", (cb) =>
cb.modifySchematic((sb) =>
sb.add("schematic_path", (sp) =>
sp.setProps({
points: [
{ x: 0, y: 0 },
{ x: 100, y: 100 },
],
})
const soup = await createProjectBuilder()
.add("component", (cb) =>
cb.modifySchematic((sb) =>
sb.add("schematic_path", (sp) =>
sp.setProps({
points: [
{ x: 0, y: 0 },
{ x: 100, y: 100 },
],
})
)
)
)
)
.build()

await logLayout("custom schematic symbol with path", soup)
t.pass()
})

0 comments on commit 314d99c

Please sign in to comment.