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

add tests for and fix #613, test toDOMElement() via mocked elements #621

Merged
merged 2 commits into from
Oct 19, 2023

Conversation

Connum
Copy link
Contributor

@Connum Connum commented Oct 19, 2023

Description

This fixes #613 which was caused by an if statement that could never be fulfilled, leading to Path properties not all making their way to the generated SVG output of toSVG(). It also fixes the properties being completely ignored by toDOMElement() and allows to test that function in the first place by mocking document.createElementNS().

Motivation and Context

We weren't able to test toDOMElement() in Node context before, that's why we missed that the properties were completely ignored. There was also no test case that would have caught the missing property for toSVG().

How Has This Been Tested?

npm run test

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I did npm run test and all tests passed green (including code styling checks).
  • I have added tests to cover my changes.
  • My change requires a change to the documentation.
  • I have updated the README accordingly.
  • I have read the CONTRIBUTING document.

@Connum Connum added bug dev Changes revolving merely around dev-related code like testing, build process, etc. labels Oct 19, 2023
Copy link
Contributor

@yne yne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yne yne merged commit eead32e into opentypejs:master Oct 19, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dev Changes revolving merely around dev-related code like testing, build process, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Path properties do not translate in Path.toSVG(2)
3 participants