Make sure that #... are trimmed from Ajax request URLs. Fixes #4987.

This commit is contained in:
John Resig 2010-09-22 12:52:44 -04:00
parent a32f4d7b6c
commit f9f9ee52e1
2 changed files with 31 additions and 0 deletions

View file

@ -68,6 +68,35 @@ test("jQuery.ajax() - error callbacks", function() {
});
});
test(".ajax() - hash", function() {
expect(3);
jQuery.ajax({
url: "data/name.html#foo",
beforeSend: function( xhr, settings ) {
equals(settings.url, "data/name.html", "Make sure that the URL is trimmed.");
return false;
}
});
jQuery.ajax({
url: "data/name.html?abc#foo",
beforeSend: function( xhr, settings ) {
equals(settings.url, "data/name.html?abc", "Make sure that the URL is trimmed.");
return false;
}
});
jQuery.ajax({
url: "data/name.html?abc#foo",
data: { "test": 123 },
beforeSend: function( xhr, settings ) {
equals(settings.url, "data/name.html?abc&test=123", "Make sure that the URL is trimmed.");
return false;
}
});
});
test(".ajax() - 304", function() {
expect( 1 );
stop();