Added support for karma testing.

EDIT: I had to close the previous pull request, some commits got messed up, but this one is clean and nice.
Now we can execute tests "headlessly" using grunt and karma. Just run "grunt karma" and the results will be displayed into the console. It uses PhantomJS in the background. There is a known issue of karma not being able to run test cases on PhantomJS (karma-runner/karma#558), currently it is working for me, and my setup is Mac OS X 10.8.4, node 0.10.13 and karma 0.8.7.
Also I've added a grunt task for jshinting the javascript files.