Skip to content

Commit 6b66fb3

Browse files
committed
Add script eval test
1 parent e8d9aa2 commit 6b66fb3

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

test/evaled.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
window.evaledSrcScript = true

test/unit/pjax.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,20 @@ if ($.support.pjax) {
118118
})
119119
})
120120

121+
asyncTest("evals scripts", function() {
122+
var frame = this.frame
123+
124+
frame.$('#main').on('pjax:success', function() {
125+
equal(true, frame.evaledSrcScript)
126+
equal(true, frame.evaledInlineScript)
127+
start()
128+
})
129+
frame.$.pjax({
130+
url: "scripts.html",
131+
container: "#main"
132+
})
133+
})
134+
121135

122136
asyncTest("container option accepts String selector", function() {
123137
var frame = this.frame

test/views/scripts.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<p>Got some script tags here</p>
2+
<script type="text/javascript" src="/test/evaled.js"></script>
3+
<script type="text/javascript">window.evaledInlineScript = true</script>
4+
<script type="text/javascript">window.parent.iframeLoad(window)</script>

0 commit comments

Comments
 (0)