forked from tscircuit/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support root.schematicDisabled to skip rendering all schematic compon…
…ents
- Loading branch information
1 parent
424c257
commit d2fcaf5
Showing
8 changed files
with
120 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
tests/examples/__snapshots__/example9-shcematicDisabled-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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { expect, test } from "bun:test" | ||
import { getTestFixture } from "../fixtures/get-test-fixture" | ||
|
||
test("Should not render any schematic components", async () => { | ||
const { circuit } = getTestFixture() | ||
circuit.schematicDisabled = true | ||
|
||
circuit.add( | ||
<board width={10} height={10}> | ||
<chip | ||
name="U1" | ||
manufacturerPartNumber="part-number" | ||
schX={0} | ||
schY={0} | ||
schWidth={1} | ||
schHeight={5} | ||
footprint="ssop28Db" | ||
/> | ||
<diode | ||
name="LED1" | ||
footprint="0805" | ||
symbolName="diode" | ||
schX={2} | ||
schY={1} | ||
/> | ||
<trace path={[".LED1 > port.right", ".U1 > .pin20"]} /> | ||
</board>, | ||
) | ||
|
||
circuit.render() | ||
|
||
const schematicComponents = circuit | ||
.getCircuitJson() | ||
.filter((c) => c.type === "schematic_component") | ||
expect(schematicComponents.length).toBe(0) | ||
const traces = circuit | ||
.getCircuitJson() | ||
.filter((c) => c.type === "schematic_trace") | ||
expect(traces.length).toBe(0) | ||
expect(circuit).toMatchSchematicSnapshot(import.meta.path) | ||
}) |