Skip to content

Commit aa38a05

Browse files
committed
Test that URL only changes on XHR success.
1 parent 6d65916 commit aa38a05

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/unit/pjax.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,26 @@ if ($.support.pjax) {
727727
})
728728
})
729729

730+
asyncTest("address bar only updates on success", function() {
731+
var frame = this.frame
732+
733+
equal(frame.location.pathname, "/home.html")
734+
735+
frame.$("#main").on('pjax:send', function() {
736+
equal(frame.location.pathname, "/home.html")
737+
})
738+
739+
frame.$("#main").on('pjax:end', function() {
740+
equal(frame.location.pathname, "/hello.html")
741+
start()
742+
})
743+
744+
frame.$.pjax({
745+
url: "hello.html",
746+
container: "#main"
747+
})
748+
})
749+
730750
function goBack(frame, callback) {
731751
setTimeout(function() {
732752
frame.$("#main").one("pjax:end", callback)

0 commit comments

Comments
 (0)