Jasmine
1.3.1 revision 1354556913
finished in 0.021s
No try/catch
Passing 58 specs
Food
init
should set correct values
changePosition
should change the position
MovingGameObject
init
should set correct values
changeDirection
when direction is Left
new direction is Left, should set direction to Left
new direction is Up, should set direction to Up
new direction is Right, should keep direction unchanged
new direction is Down, should set direction to Down
when direction is Up
new direction is Left, should set direction to Left
new direction is Up, should set direction to Up
new direction is Right, should set direction to Right
new direction is Down, should keep direction unchanged
when direction is Right
new direction is Left, should keep direction unchanged
new direction is Up, should set direction to Up
new direction is Right, should set direction to Right
new direction is Down, should set direction to Down
when direction is Down
new direction is Left, should set direction to Left
new direction is Up, should keep direction unchanged
new direction is Right, should set direction to Right
new direction is Down, should set direction to Down
move
should decrease x when direction is Left
should decrease y when direction is Up
should increase x when direction is Right
should increase y when direction is Down
Snake
init
Should set correct values
Should contain 5 SnakePieces
consume
When object is food, should grow
When object is Obstacle, should die
When object is SnakePiece, should die
should increase speed when eats five Food objects
changeDirection
when direction is Left
new direction is Left, should set direction to Left
new direction is Up, should set direction to Up
new direction is Right, should set direction to Left
new direction is Down, should set direction to Down
when direction is Up
new direction is Left, should set direction to Left
new direction is Up, should set direction to Up
new direction is Right, should set direction to Right
new direction is Down, should set direction to Up
when direction is Right
new direction is Left, should set direction to Right
new direction is Up, should set direction to Up
new direction is Right, should set direction to Right
new direction is Down, should set direction to Down
when direction is Down
new direction is Left, should set direction to Left
new direction is Up, should set direction to Down
new direction is Right, should set direction to Right
new direction is Down, should set direction to Down
move
should decrease x when direction is Left
should decrease y when direction is Up
should increase x when direction is Right
should increase y when direction is Down
grow
should increase the size
draw
should interact with canvas context
addDieHandler
should attach handler
die
should call handlers with result object
SnakePiece
init
Should set correct values
move
when direction is 0, should decrease x
when direction is 1, should decrease y
when direction is 2, should increase x
when direction is 3, should increase y