-
Notifications
You must be signed in to change notification settings - Fork 92
fix: board width height when outline is passed #1514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…is not passed and rather outline is passed
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| import { test, expect } from "bun:test" | ||
| import { getTestFixture } from "tests/fixtures/get-test-fixture" | ||
|
|
||
| test("board outline dimension is calculated correctly", () => { | ||
| const { circuit } = getTestFixture() | ||
|
|
||
| circuit.add( | ||
| <board | ||
| outline={[ | ||
| { x: -8, y: -8 }, | ||
| { x: 8, y: -8 }, | ||
| { x: 8, y: 8 }, | ||
| { x: -8, y: 8 }, | ||
| ]} | ||
| > | ||
| <resistor name="R1" resistance="10k" footprint="0402" /> | ||
| <capacitor name="C1" capacitance="10uF" footprint="0603" /> | ||
| </board>, | ||
| ) | ||
|
|
||
| circuit.render() | ||
|
|
||
| const pcb_board = circuit.db.pcb_board.list()[0] | ||
| expect(pcb_board.width).toBe(16) | ||
| expect(pcb_board.height).toBe(16) | ||
|
|
||
| expect(circuit).toMatchPcbSnapshot(import.meta.path) | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File naming inconsistency: board-outline-dimension.test.tsx should use .test.ts extension instead of .test.tsx. The .tsx extension is reserved for React components containing JSX, while standard test files should use .ts to maintain consistency with the project's naming conventions.
Spotted by Graphite Agent (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
seveibar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its a bit ambiguous if width/height are also present if outline is present. The width and height become the bounds. I’d rather have width/height be undefined if an outline is present i think but we could add a “shape” property to board in the future to help clear up ambiguity
doInitialPcbBoardAutoSize()method was overwriting these calculated values with auto-calculated dimensions based on component placement