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 automated testing and snapshots with pdftest #454

Merged
merged 59 commits into from
Jul 9, 2021

Conversation

eKoopmans
Copy link
Owner

This PR:

  • uses Karma to run Mocha/Chai tests in the browser
  • adds unit tests for basic functionality and settings
  • adds snapshot tests for:
    • blank PDF
    • lorem ipsum text (with default settings, a 1-inch margin, and "legacy" mode)
    • all visible HTML tags
    • CSS selectors
    • page-breaks (legacy mode, CSS mode, avoid-all mode, and specific-selectors moe)

Known bugs

  • all-tags.html:
    • omitted due to bugs: <q> and <iframe>
    • styling errors: <col>
    • render errors: <details> (number instead of icon), <select> (no icon), <bdo> (doesn't reverse text)
    • not rendered at all: <meter>, <progress>, <embed>, <object>, <audio>, <video>
    • some questionable rendering choices for the <form> / <input> section
  • css-selectors.html:
    • "unincluded ancestor": this is a known bug related to how html2pdf.js clones elements, should be fixed soon

Future todo

  • set up CI for this with Saucelabs
    • test on PRs/pushes
    • add badge to readme
  • more unit tests and snapshots

Other notes

  • this was a very long work-in-progress (work began in April 2019)
  • motivated the creation of pdftest

@eKoopmans
Copy link
Owner Author

Removed a code-fix for set({ pageSize }) that was discovered while building tests. Will make a separate PR for that fix.

@eKoopmans eKoopmans merged commit 3b2d8cf into master Jul 9, 2021
@eKoopmans eKoopmans deleted the feature/testing-pdftest branch July 9, 2021 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant