Skip to content
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

Write tests #14

Open
cyyynthia opened this issue Jul 11, 2024 · 2 comments
Open

Write tests #14

cyyynthia opened this issue Jul 11, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@cyyynthia
Copy link
Owner

Not sure what the best strategy would be here...

@cyyynthia cyyynthia added the enhancement New feature or request label Jul 11, 2024
@mary-ext
Copy link
Contributor

mary-ext commented Jul 15, 2024

We can move the transformations out of the load hook so that we can do snapshot tests of the resulting SVG and JS code, that should be good for a start.

After that we can move on to browser screenshot testing, to make it easier to see if the SVGs are being shown correctly

@cyyynthia
Copy link
Owner Author

Sounds good to me. https://playwright.dev/docs/test-snapshots should be the most appropriate tool for the screenshot job; Ideally all browsers should have a very similar output but I don't know if the difference between render engines will require using different screenshots to compare.

Points to test are:

  • Width/Height preservation, if enabled (unit)
  • Width/Height configuration, if enabled (unit)
  • Behavior when both of the above are enabled (unit)
  • ViewBox restoration, if enabled (unit)
  • Fill/Stroke replacement, if enabled (unit)
    • none should never be replaced
  • The generated code should work (visual)
  • Correct processing of referenced resources within the SVG
    • image, use, ...
    • The generated SVG should be visually identical to the source SVG
  • All targets render the same (happydom/jsdom should be enough for this one)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants