Skip to content

Commit 717860d

Browse files
committed
Add basic browser history test
1 parent 7ef91e7 commit 717860d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/unit/pjax_fallback.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,34 @@ asyncTest("sends correct HTTP referer after failed request"+s, function() {
118118
})
119119
})
120120

121+
asyncTest("adds entry to browser history"+s, function() {
122+
var frame = this.frame
123+
var count = 0
124+
125+
frame.onpopstate = function() {
126+
window.iframeLoad(frame)
127+
}
128+
129+
this.loaded = function() {
130+
count++
131+
132+
if (count == 1) {
133+
equal(frame.location.pathname, "/hello.html")
134+
ok(frame.history.length > 1)
135+
frame.history.back()
136+
} else if (count == 2) {
137+
equal(frame.location.pathname, "/home.html")
138+
frame.history.forward()
139+
start()
140+
}
141+
}
142+
143+
frame.$.pjax({
144+
url: "hello.html",
145+
container: "#main"
146+
})
147+
})
148+
121149
asyncTest("scrolls to top of the page"+s, function() {
122150
var frame = this.frame
123151

0 commit comments

Comments
 (0)