Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/pcb/pcb_panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const pcb_panel = z
height: length,
center: point,
covered_with_solder_mask: z.boolean().optional().default(true),
layout_mode: z.enum(["none", "grid"]).optional(),
})
.describe("Defines a PCB panel that can contain multiple boards")

Expand All @@ -24,6 +25,7 @@ export interface PcbPanel {
height: Length
center: Point
covered_with_solder_mask: boolean
layout_mode?: "none" | "grid"
}

export type PcbPanelInput = z.input<typeof pcb_panel>
Expand Down
17 changes: 17 additions & 0 deletions tests/pcb_panel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ test("pcb_panel parses and defaults covered_with_solder_mask", () => {
width: "100mm",
height: "200mm",
center: { x: 0, y: 0 },
layout_mode: "none",
}

const parsed = pcb_panel.parse(panelData)

expect(parsed.covered_with_solder_mask).toBe(true)
expect(parsed.layout_mode).toBe("none")
})

test("any_circuit_element includes pcb_panel", () => {
Expand All @@ -28,3 +30,18 @@ test("any_circuit_element includes pcb_panel", () => {

expect(() => any_circuit_element.parse(panelData)).not.toThrow()
})

test("pcb_panel parses with layoutMode grid", () => {
const panelData = {
type: "pcb_panel" as const,
pcb_panel_id: "pcb_panel_1",
width: "100mm",
height: "200mm",
center: { x: 0, y: 0 },
layout_mode: "grid" as const,
}

const parsed = pcb_panel.parse(panelData)

expect(parsed.layout_mode).toBe("grid")
})