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.
feat: schDisplayLabel prop for <trace /> with test. (tscircuit#381)
* feat: schDisplayLabel prop for <trace /> with tests * improved the logic to handel path prop and errors * improved the PR
- Loading branch information
Showing
6 changed files
with
241 additions
and
3 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
13 changes: 13 additions & 0 deletions
13
tests/examples/__snapshots__/example10-schDisplayLabel-pcb.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions
59
tests/examples/__snapshots__/example10-schDisplayLabel-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,62 @@ | ||
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.add( | ||
<board width={20} height={20}> | ||
<resistor | ||
name="R1" | ||
footprint="0603" | ||
schX={8} | ||
schY={-1} | ||
pcbX={0} | ||
resistance="10k" | ||
/> | ||
<resistor | ||
name="R2" | ||
footprint="0603" | ||
schX={0} | ||
schY={-1} | ||
pcbX={4} | ||
resistance="10k" | ||
/> | ||
<capacitor | ||
name="C1" | ||
footprint="0603" | ||
schX={4} | ||
schY={1} | ||
pcbX={-4} | ||
capacitance="10k" | ||
/> | ||
<capacitor | ||
name="C2" | ||
footprint="0603" | ||
schX={2} | ||
schY={0} | ||
pcbX={-8} | ||
capacitance="10k" | ||
/> | ||
|
||
<trace from={".C1 > .pin1"} to={".R2 > .pin1"} /> | ||
<trace schDisplayLabel="C2_POS" path={[".C1 > .pin2", ".C2 > .pin2"]} /> | ||
<trace | ||
pcbRouteHints={[{ x: 2, y: -8 }]} | ||
schDisplayLabel="C2_POS" | ||
from={".C2 > .pin2"} | ||
to={".R1 > .pin2"} | ||
/> | ||
<trace | ||
pcbRouteHints={[{ x: 2, y: -8 }]} | ||
schDisplayLabel="R1_1" | ||
from={".R1 > .pin1"} | ||
to={".C2 > .pin1"} | ||
/> | ||
</board>, | ||
) | ||
|
||
circuit.render() | ||
expect(circuit).toMatchPcbSnapshot(import.meta.path) | ||
expect(circuit).toMatchSchematicSnapshot(import.meta.path) | ||
}) |