I have been experimenting with methods over the past few weeks, trying to find a better method to use BDD for a web application that relies on HTML5 canvas element and interaction with it.
I use Jasmine and Cucumber with Rspec, I test every part of my application for specification and integration, but any attempt I had to make to test the canvas came ... unsuccessful. I wrote a jQuery plugin that handles interaction with the canvas and also initializes it.
I wanted Intergration to check the actual drawing on the canvas, making sure when you call something like
$("canvas").draw("lineTo", 10, 10)
there is actually a line created on the canvas element at points (10, 10). This is what turned out to be a substitute, I tried to use the getImageData () context method for any drawn pixels. This led me to a hole, no matter how I request the canvas. I get pixel data representing a black transparent pixel, which according to MDC says that I request a canvas from the context.
This, I think, is the problem with the Jasmine pearl with RoR. If I could solve this issue, I would be golden, but this is not the only decision that I am ready to make. I really would like to help think of an effective way to integrate the canvas test, even if I don't actually check the pixel data.
Thanks to someone for your help, it really put me in the block.