Added tests
Had to remove window reloads

We should never reload a window in angular but use $location instead.
Using window reloads also breaks karma testing