Skip to content

Commit 038a316

Browse files
feat: add schsim svg type
1 parent ae2f3af commit 038a316

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function getUncompressedSnippetString(
3939

4040
export function createSvgUrl(
4141
snippetOrFsMap: string | FsMap,
42-
svgType: "pcb" | "schematic" | "3d" | "pinout",
42+
svgType: "pcb" | "schematic" | "3d" | "pinout" | "schsim",
4343
options: CreateSvgUrlOptions = {},
4444
) {
4545
const search = new URLSearchParams()

tests/test3-svg-url.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,20 @@ export default () => (
100100
`"https://svg.tscircuit.com/?svg_type=pinout&code=H4sIAJsBqGcAAy2NTQ7CIBhE9z3FhFW7KlWXhUO4ckuBClF%2BAp%2FRxHh30Xb3JvMyY185FYKxq3rcCf0AIdF3wLwkVQye3pATbOIhMDjrr472JJvUtGKrr5QKNlBR2ybcGNaUKBcfm89P%2FMAQVWjVeWKo2l3E%2B%2FhB1ssG429tHv%2Bfshu%2BlSYxzJYAAAA%3D"`,
101101
)
102102
})
103+
104+
test("create schsim svg url", () => {
105+
const url = createSvgUrl(
106+
`
107+
export default () => (
108+
<board width="10mm" height="10mm">
109+
<resistor resistance="1k" footprint="0402" name="R1" schX={3} pcbX={3} />
110+
</board>
111+
)
112+
`,
113+
"schsim",
114+
)
115+
116+
expect(url).toMatchInlineSnapshot(
117+
`"https://svg.tscircuit.com/?svg_type=schsim&code=H4sIAJsBqGcAAy2NTQ7CIBhE9z3FhFW7KlWXhUO4ckuBClF%2BAp%2FRxHh30Xb3JvMyY185FYKxq3rcCf0AIdF3wLwkVQye3pATbOIhMDjrr472JJvUtGKrr5QKNlBR2ybcGNaUKBcfm89P%2FMAQVWjVeWKo2l3E%2B%2FhB1ssG429tHv%2Bfshu%2BlSYxzJYAAAA%3D"`,
118+
)
119+
})

0 commit comments

Comments
 (0)