Skip to content
This repository has been archived by the owner on Dec 16, 2023. It is now read-only.

Commit

Permalink
[Closes #156] missing pathname support for window.location.href
Browse files Browse the repository at this point in the history
  • Loading branch information
assaf committed Jul 29, 2011
1 parent f78fcab commit 4172c64
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,8 @@ zombie.js-changelog(7) -- Changelog

Fixed: require.paths is deprecated [#158]

Fixd: missing pathname support for window.location.href [#156]


### Version 0.9.6 2011-07-28

Expand Down
9 changes: 9 additions & 0 deletions spec/history-spec.coffee
Expand Up @@ -103,6 +103,15 @@ vows.describe("History").addBatch(
"should add page to history": (browser)-> assert.length browser.window.history, 2
"should change location URL": (browser)-> assert.equal browser.location, "http://localhost:3003/history/boo"
"should load document": (browser)-> assert.match browser.html(), /Eeek!/
"change relative href":
zombie.wants "http://localhost:3003/"
topic: (browser)->
browser.window.location.href = "/history/boo"
browser.window.document.addEventListener "DOMContentLoaded", => @callback null, browser
return
"should add page to history": (browser)-> assert.length browser.window.history, 2
"should change location URL": (browser)-> assert.equal browser.location, "http://localhost:3003/history/boo"
"should load document": (browser)-> assert.match browser.html(), /Eeek!/
"change hash":
zombie.wants "http://localhost:3003/"
topic: (browser)->
Expand Down
3 changes: 2 additions & 1 deletion src/zombie/history.coffee
Expand Up @@ -221,7 +221,8 @@ class Location
# ### location.href => String
@__defineGetter__ "href", -> url?.href
# ### location.href = url
@__defineSetter__ "href", (url)-> history._assign url
@__defineSetter__ "href", (new_url)->
history._assign URL.resolve(url, new_url)
# Getter/setter for location parts.
for prop in ["hash", "host", "hostname", "pathname", "port", "protocol", "search"]
do (prop)=>
Expand Down

0 comments on commit 4172c64

Please sign in to comment.