Skip to content

Commit

Permalink
Fix timeout test
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Jan 22, 2013
1 parent 4f4b04b commit 13e3f3a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/unit/pjax.js
Expand Up @@ -796,6 +796,7 @@ if ($.support.pjax) {
})
})

// Test is fragile
asyncTest("no initial pjax:popstate event", function() {
var frame = this.frame
var count = 0;
Expand All @@ -812,12 +813,15 @@ if ($.support.pjax) {
} else if (count == 3) {
equal(frame.location.pathname, "/env.html")
frame.history.back()
setTimeout(function() { window.iframeLoad(frame) }, 1000)
} else if (count == 4) {
equal(frame.location.pathname, "/hello.html")
frame.history.back()
setTimeout(function() { window.iframeLoad(frame) }, 1000)
} else if (count == 5) {
equal(frame.location.pathname, "/home.html")
frame.history.forward()
setTimeout(function() { window.iframeLoad(frame) }, 1000)
} else if (count == 6) {
// Should skip pjax:popstate since theres no initial pjax.state
frame.$('#main').on('pjax:popstate', function(event) {
Expand All @@ -834,8 +838,9 @@ if ($.support.pjax) {
if (count == 6) {
count++
frame.history.forward()
setTimeout(function() { window.iframeLoad(frame) }, 1000)
} else {
start()
setTimeout(function() { start() }, 1000)
}
})
}
Expand Down

0 comments on commit 13e3f3a

Please sign in to comment.