Navigation.go supports full URLs

This commit is contained in:
Rohan Mitchell
2014-06-27 11:51:53 +10:00
parent b678a2f7fd
commit 4075854440
2 changed files with 24 additions and 5 deletions

View File

@@ -1,11 +1,28 @@
describe 'Navigation service', ->
Navigation = null
window =
location:
href: null
pathname: null
beforeEach ->
module 'Darkswarm'
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"