How can I unit-test Javascript that draws on an HTML canvas? Drawing on the canvas should be checked.
See Question&Answers more detail:osHow can I unit-test Javascript that draws on an HTML canvas? Drawing on the canvas should be checked.
See Question&Answers more detail:osI wrote an example for unit-testing canvas and other image-y types with Jasmine and js-imagediff.
I find this to be better than making sure specific methods on a mock Canvas have been invoked because different series of methods may produce the same method. Typically, I will create a canvas with the expected value or use a known-stable version of the code to test a development version against.