Skip to content
Merged
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
1 change: 1 addition & 0 deletions lib/components/primitive-components/Group/Group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,7 @@ export class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
height: 0,
schematic_component_ids: [],
source_group_id: this.source_group_id!,
show_as_schematic_box: props.showAsSchematicBox ?? false,
})
this.schematic_group_id = schematic_group.schematic_group_id

Expand Down
25 changes: 25 additions & 0 deletions tests/groups/__snapshots__/group-schematic-box-schematic.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions tests/groups/group-schematic-box.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { expect, test } from "bun:test"
import { getTestFixture } from "tests/fixtures/get-test-fixture"

test("group schematic box", () => {
const { circuit } = getTestFixture()
circuit.add(
<board routingDisabled>
<group name="G1" showAsSchematicBox>
<resistor name="R1" resistance="1k" footprint="0402" />
<capacitor name="C1" capacitance="1uF" footprint="0402" />
</group>
</board>,
)

circuit.render()

const schematic_group = circuit.db.schematic_group
.list()
.filter((g) => g.name === "G1")
expect(schematic_group).toMatchInlineSnapshot(`
[
{
"center": {
"x": 0,
"y": 0,
},
"height": 0,
"is_subcircuit": undefined,
"name": "G1",
"schematic_component_ids": [],
"schematic_group_id": "schematic_group_0",
"show_as_schematic_box": true,
"source_group_id": "source_group_0",
"subcircuit_id": null,
"type": "schematic_group",
"width": 0,
},
]
`)

expect(circuit).toMatchSchematicSnapshot(import.meta.path)
})
Loading