QUnit unit tests

Added unit tests with [QUnit](http://qunitjs.com/).