Skip to content

Commit c952ed8

Browse files
tdhoopermislav
authored andcommitted
Create failing test for ampersands in urls
1 parent 65c4f34 commit c952ed8

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

test/app.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,7 @@ def title(str)
9393
get '/:page.html' do
9494
erb :"#{params[:page]}", :layout => !pjax?
9595
end
96+
97+
get '/some-&-path/hello.html' do
98+
erb :hello, :layout => !pjax?
99+
end

test/unit/pjax.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,4 +1091,18 @@ if ($.support.pjax) {
10911091
container: "#main"
10921092
})
10931093
})
1094+
1095+
asyncTest("copes with ampersands when pushing urls", function() {
1096+
var frame = this.frame
1097+
1098+
frame.$('#main').on('pjax:success', function() {
1099+
equal(frame.location.pathname, "/some-&-path/hello.html")
1100+
equal(frame.location.search, "")
1101+
start()
1102+
})
1103+
frame.$.pjax({
1104+
url: "/some-&-path/hello.html",
1105+
container: "#main"
1106+
})
1107+
})
10941108
}

0 commit comments

Comments
 (0)