mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
28 lines
703 B
CoffeeScript
28 lines
703 B
CoffeeScript
describe 'Navigation service', ->
|
|
Navigation = null
|
|
window =
|
|
location:
|
|
href: null
|
|
pathname: 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.pathname).toEqual "/woo/yeah"
|
|
|