Switching to Karma testing framework

This switches Testacular out for Karma 0.10. It also makes some changes towards testability.