happo / happo-cypress

A Happo integration with Cypress.io
35 stars 4 forks source link

Broken inlined svg when `canvas` has width and height attributes set to "0" #22

Open trotzig opened 4 years ago

trotzig commented 4 years ago

This canvas

<canvas height="0" width="0" />

will return data:, for canvas.toDataURL(), even though it might have content. We should handle this better than what we're doing right now: producing an invalid png image and including in the asset package.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL#:~:text=toDataURL()%20method%20returns%20a,data%3A%2C%22%20is%20returned.