mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
I looked through the history and it looks like this function was a bit flawed (preserving hash fragments) from the beginning. It has been patched a few times without addressing the underlying issue that we want more than just replacing the pathname. We want to go somewhere else.
27 lines
674 B
CoffeeScript
27 lines
674 B
CoffeeScript
describe 'Navigation service', ->
|
|
Navigation = null
|
|
window =
|
|
location:
|
|
href: null
|
|
|
|
beforeEach ->
|
|
module 'Darkswarm', ($provide) ->
|
|
$provide.value "$window", window
|
|
null
|
|
inject ($injector)->
|
|
Navigation = $injector.get("Navigation")
|
|
|
|
|
|
it "caches the path provided", ->
|
|
Navigation.navigate "/foo"
|
|
expect(Navigation.path).toEqual "/foo"
|
|
|
|
describe "redirecting", ->
|
|
it "redirects to full URLs", ->
|
|
Navigation.go "http://google.com"
|
|
expect(window.location.href).toEqual "http://google.com"
|
|
|
|
it "redirects to paths", ->
|
|
Navigation.go "/woo/yeah"
|
|
expect(window.location.href).toEqual "/woo/yeah"
|