Add dash length and gap support to schematic line and path#586
Conversation
| @@ -17,6 +18,39 @@ test("schematic_line defaults stroke width and color", () => { | |||
| expect(line.schematic_line_id).toMatch(/^schematic_line_/) | |||
| expect(line.color).toBe("#000000") | |||
| expect(line.is_dashed).toBe(false) | |||
| expect(line).not.toHaveProperty("dash_length") | |||
| expect(line).not.toHaveProperty("dash_gap") | |||
| }) | |||
|
|
|||
| test("schematic_line accepts dash distance parameters", () => { | |||
| const line = schematic_line.parse({ | |||
| type: "schematic_line", | |||
| x1: 0, | |||
| y1: 0, | |||
| x2: 1, | |||
| y2: 1, | |||
| is_dashed: true, | |||
| dash_length: "2mm", | |||
| dash_gap: "1mm", | |||
| }) | |||
|
|
|||
| expect(line.dash_length).toBe(2) | |||
| expect(line.dash_gap).toBe(1) | |||
| }) | |||
|
|
|||
| test("schematic_path accepts dash distance parameters", () => { | |||
| const path = schematic_path.parse({ | |||
| type: "schematic_path", | |||
| points: [ | |||
| { x: 0, y: 0 }, | |||
| { x: 1, y: 1 }, | |||
| ], | |||
| dash_length: "2mm", | |||
| dash_gap: "1mm", | |||
| }) | |||
|
|
|||
| expect(path.dash_length).toBe(2) | |||
| expect(path.dash_gap).toBe(1) | |||
| }) | |||
There was a problem hiding this comment.
This file now contains multiple test(...) calls (at least 4: 'schematic_line defaults stroke width and color', 'schematic_line accepts dash distance parameters', 'schematic_path accepts dash distance parameters', and 'schematic_rect assigns defaults'). The rule states that a *.test.ts file may have AT MOST one test(...). The tests should be split into multiple numbered files, e.g. schematic_shapes1.test.ts, schematic_shapes2.test.ts, etc. — or named more specifically per shape, e.g. schematic_line1.test.ts, schematic_line2.test.ts, schematic_path1.test.ts, schematic_rect1.test.ts.
| test("schematic_line defaults stroke width and color", () => { | |
| const line = schematic_line.parse({ | |
| expect(line.schematic_line_id).toMatch(/^schematic_line_/) | |
| expect(line.color).toBe("#000000") | |
| expect(line.is_dashed).toBe(false) | |
| expect(line).not.toHaveProperty("dash_length") | |
| expect(line).not.toHaveProperty("dash_gap") | |
| }) | |
Spotted by Graphite (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
|
Thank you for your contribution! 🎉 PR Rating: ⭐⭐ Track your contributions and see the leaderboard at: tscircuit Contribution Tracker |
Summary
dash_lengthanddash_gapdistance fields toschematic_lineandschematic_pathTesting
bun testbunx tsc --noEmitbun run scripts/zod-lint.tsgit diff --check