added karma support

added karma
moved tests to work with karma and normal testing
fixed bugs with firefox and safari compatibility