diff --git a/lib/components/primitive-components/Group/Group.ts b/lib/components/primitive-components/Group/Group.ts index 5e2fa6775..134e7632c 100644 --- a/lib/components/primitive-components/Group/Group.ts +++ b/lib/components/primitive-components/Group/Group.ts @@ -949,6 +949,7 @@ export class Group = 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 diff --git a/tests/groups/__snapshots__/group-schematic-box-schematic.snap.svg b/tests/groups/__snapshots__/group-schematic-box-schematic.snap.svg new file mode 100644 index 000000000..e3d5f956f --- /dev/null +++ b/tests/groups/__snapshots__/group-schematic-box-schematic.snap.svg @@ -0,0 +1,25 @@ +-2,-3-2,-2-2,-1-2,0-2,1-1,-3-1,-2-1,-1-1,0-1,10,-30,-20,-10,00,11,-31,-21,-11,01,12,-32,-22,-12,02,1R11kΩC11uF \ No newline at end of file diff --git a/tests/groups/group-schematic-box.test.tsx b/tests/groups/group-schematic-box.test.tsx new file mode 100644 index 000000000..72a5d1893 --- /dev/null +++ b/tests/groups/group-schematic-box.test.tsx @@ -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( + + + + + + , + ) + + 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) +})