-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #224 from tscircuit/fix/shifting-port-position
feat: add support for manualEdits
- Loading branch information
Showing
5 changed files
with
70 additions
and
20 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
.../components/primitive-components/__snapshots__/manual-edits-layout-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.
15 changes: 15 additions & 0 deletions
15
tests/components/primitive-components/json/manual-edits.json
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,15 @@ | ||
{ | ||
"pcb_placements": [ | ||
{ | ||
"selector": "R1", | ||
"center": { | ||
"x": 0, | ||
"y": 6.869495369849336 | ||
}, | ||
"relative_to": "group_center", | ||
"_edit_event_id": "0.037205222437411756" | ||
} | ||
], | ||
"edit_events": [], | ||
"manual_trace_hints": [] | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/components/primitive-components/manual-edits-layout.test.tsx
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,17 @@ | ||
import { expect, test } from "bun:test" | ||
import { getTestFixture } from "tests/fixtures/get-test-fixture" | ||
import manualEdits from "./json/manual-edits.json" | ||
|
||
test("Manual edits prop usage", () => { | ||
const { project } = getTestFixture() | ||
|
||
project.add( | ||
<board width="10mm" height="10mm" manualEdits={manualEdits}> | ||
<resistor name="R1" resistance="100" footprint="0402"/> | ||
</board>, | ||
) | ||
|
||
project.render() | ||
|
||
expect(project).toMatchPcbSnapshot(import.meta.path) | ||
}) |