Animatron/player — pull request #38 by shamansir (2012-08-20 13:24:14+00:00)
Title: Introducing Jasmine Tests + Refactoring of Player Intialization

Introducing [Jasmine](http://pivotal.github.com/jasmine/) for tests. + several tests on player initialization. Tests are separated in groups:

* Player tests
* Animations Tests
* Animatron Importer Tests
* Builder Tests
* Collisions Tests
* Bugs Tests

Open `tests/index.html` to see links to all of the tests group (currently there are only 28 specs for player itself) and run them. Also, I will deploy them to `animatron.com` recently.

-----

Due to refactoring, there are some major changes for the user of player:

* There is now `anim` label instead of `cnvs` in options object, because it configures the animation in fact, like width/height, background, duration, FPS. Please change accordingly, because instead player will immediately break.
* `createPlayer('id', opts);` is now identical to `var p = new Player(); p.init('id', opts);` (before it was `new Player('id', opts)`), it is useful for tests and for pre-creating player before passing options to it. By the way, it now accepts the DOM element as canvas, so you may also write `createPlayer(document.getElementById('canvas'))`
* If you change player mode through `player.mode` instead of options, do it before calling `init()`. It is still ok, however, to change `player.debug` in any time.
* Canvas is now prepared exactly when you call `init` (or `createPlayer`); Before, it was a fallback to initialize canvas immediately before loading the scene. (I don't remember why :) )