-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for computing schematic transform
- Loading branch information
Showing
5 changed files
with
34 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { test, expect } from "bun:test" | ||
import { convertCircuitJsonToSchematicSvg } from "lib" | ||
|
||
test("svg should have data-real-to-screen-transform attribute", () => { | ||
const svg = convertCircuitJsonToSchematicSvg([ | ||
{ | ||
type: "schematic_box", | ||
x: 0, | ||
y: 0, | ||
width: 10, | ||
height: 10, | ||
schematic_component_id: "1", | ||
}, | ||
]) | ||
|
||
// Check that the SVG contains the data-real-to-screen-transform attribute | ||
expect(svg).toContain('data-real-to-screen-transform="') | ||
|
||
// Extract the transform value and verify it's a valid matrix string | ||
const match = svg.match(/data-real-to-screen-transform="([^"]+)"/) | ||
|
||
// @ts-ignore | ||
expect(match[1]).toMatchInlineSnapshot(`"matrix(54.5454545455,0,0,-54.5454545455,600,300)"`) | ||
}) |