Files
openfoodnetwork/spec/javascripts/unit/darkswarm/services/navigation.js.coffee
Maikel Linke fb02bdd25a Simplify Navigation.go, not preserving hash fragments
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.
2018-06-21 10:29:32 +10:00

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"